Page 2 of 2 First 12
  • Jump to page:
    #16
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    13
    Rep Power
    0
    Every instance of $row in the sample code you provided was replaced with $a_row apparently
    its the var that is returned and $row is not....

    also ["name"] and ['name'] broke it, the whole T_STRING issue came up....I do not know if [name] worked or not because the number of the row works and as long as it works, its fine by me

    I do however have one more question....
    How do you pull a random entry out, lets say for example, I hate 10,000 quotes in a DB, and I want to pull one out at random and print it, how would I go about doing that?

    Much thanks for your help guys....
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by SepodatiCreations:
    ????????

    $row = $a_row????

    did you change
    while ($row = mysql_fetch_array($result))
    into
    while ($a_row = mysql_fetch_array($result))
    also?????

    Using the numbers or the names works. it just makes your code easier to read if you use the names. You shouldn't have to use quotes around the names in the array, either.

    $row["name"]
    and
    $row[name]

    both work. they do for me at least.

    ---John Holmes...
    [/quote]

  2. #17
  3. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,643
    Rep Power
    4492
    Something still isn't right. If you have $row = then there's no reason anything should be assigned to $a_row. Also, your logic that $a_row[1] would print out name because it's the second entry in the table creation is flawed to. The primary key doesn't take up a column. It all depends on your select statement. either of these will work

    SELECT name,email,ipaddr,post FROM your_table
    SELECT email,name,post,ipaddr FROM your_table
    SELECT ipaddr,email,name,post FROM your_table

    In each one $row ($a_row??) zero will be the first entry, 1 = second, 2 = third, etc...

    You can even do this

    SELECT name,ipaddr,name,post,name,email,name,name,name FROM your_table;

    Then $row[0],[2],[4],[6],[7],and[8] will be equal to name.

    I'm not sure if either of us can explain it enough so that the other person will understand what the other is doing.....

    ---John Holmes...

    Oh..for you last question, use this

    SELECT post FROM your_table ORDER BY RAND() LIMIT 1

    to get a random post if you haTe 10,000 entries...hehe...

    ---John Holmes2...
  4. #18
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    13
    Rep Power
    0
    ok, oooone last question.... (uh, yeah, notice Iamnot making any promises ; )

    How do you create a table that corresponds to the current day of the month
    like "nov_142_000"

    I am GUESSING you just use a regular CREATE TABLE query in a mysql_query(blah blah); format. But so far I am not having any luck.
  6. #19
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    13
    Rep Power
    0
    hehehe ok so nevermind, I figured it out

    Thanks for all the help you guys have given me
Page 2 of 2 First 12
  • Jump to page:

Similar Threads

  1. PHP data retrieval question with MySQL
    By gursharn in forum PHP Development
    Replies: 7
    Last Post: December 31st, 2003, 09:43 AM
  2. beginner question...
    By mosley in forum HTML Programming
    Replies: 2
    Last Post: December 8th, 2003, 03:28 PM
  3. document.all question (beginner)
    By mosley in forum HTML Programming
    Replies: 1
    Last Post: December 4th, 2003, 09:51 AM
  4. Javascript question mark question?
    By tajmiester in forum JavaScript Development
    Replies: 3
    Last Post: November 30th, 2003, 05:36 PM
  5. Radio Buttons
    By Ulysses Freeman in forum HTML Programming
    Replies: 4
    Last Post: November 15th, 2003, 09:57 PM

IMN logo majestic logo threadwatch logo seochat tools logo