November 14th, 2000, 12:36 AM
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))
while ($a_row = mysql_fetch_array($result))
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.
both work. they do for me at least.
November 14th, 2000, 05:33 AM
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 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,,,,,and 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.....
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...
November 14th, 2000, 10:37 PM
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
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.
November 14th, 2000, 11:07 PM
hehehe ok so nevermind, I figured it out
Thanks for all the help you guys have given me