Re: [PHP] invert
On Thu, August 25, 2005 2:38 pm, George B wrote: mysql_query('SELECT * FROM table ORDER BY increment_field DESC'); Remember when I told you that you should consistently use: mysql_query(...) or die(mysql_error()); so that MySQL would TELL you what the error was? I meant it when I said that. Because otherwise you're going to post to this list EVERY time you make a simple mistake in SQL, and people will stop ignoring you because you don't listen to what we tell you :-) If I do that... then i get this error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in myfile name on line 30 and on line 30 it says while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { Although it's also possible in this case that you simply didn't put: $result = mysql_query(...); so $result has *NOTHING* in it. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] invert
if you are using mysql, just put the DESC (descending) directive at the end of your sql statement (default is no DESC directive, meaning ascending). most recent records will be returned first. Jordan On Aug 25, 2005, at 2:21 PM, George B wrote: I have written a shoutbox, and it works great, but I am wondering... When a user posts a shout it goes below the first shout. Like the auto_increment puts the ID up higher. I need it to go about the first shout, so like the auto_increment would invert. Someone told me this is possible through PHP. Is that true? and if so how do you do it? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] invert
[snip] I have written a shoutbox, and it works great, but I am wondering... When a user posts a shout it goes below the first shout. Like the auto_increment puts the ID up higher. I need it to go about the first shout, so like the auto_increment would invert. Someone told me this is possible through PHP. Is that true? and if so how do you do it? [/snip] It is true and I would use some code. C'mon George, send us some of your code so the we can may an educated guess about what to do. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] invert
Jordan Miller wrote: if you are using mysql, just put the DESC (descending) directive at the end of your sql statement (default is no DESC directive, meaning ascending). most recent records will be returned first. Jordan On Aug 25, 2005, at 2:21 PM, George B wrote: I have written a shoutbox, and it works great, but I am wondering... When a user posts a shout it goes below the first shout. Like the auto_increment puts the ID up higher. I need it to go about the first shout, so like the auto_increment would invert. Someone told me this is possible through PHP. Is that true? and if so how do you do it? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Where do I find DESC? I am looking at the php my admin and I see Field Type Length/Values Attributes Null Default** Extra No place to add DESC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] invert
W odpowiedzi na maila (21:21 - 25 sierpnia 2005): I have written a shoutbox, and it works great, but I am wondering... When a user posts a shout it goes below the first shout. Like the auto_increment puts the ID up higher. I need it to go about the first shout, so like the auto_increment would invert. Someone told me this is possible through PHP. Is that true? and if so how do you do it? mysql_query('SELECT * FROM table ORDER BY increment_field DESC'); http://dev.mysql.com/doc/mysql/en/order-by-optimization.html or get all output from DB into array and use array_reverse(); http://us2.php.net/manual/pl/function.array-reverse.php -- pozdrawiam Łukasz nostra Wojciechowski gg.1028640 * icq.23059512 -- Startuj z INTERIA.PL! http://link.interia.pl/f186c -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] invert
Łukasz 'nostra' Wojciechowski wrote: W odpowiedzi na maila (21:21 - 25 sierpnia 2005): I have written a shoutbox, and it works great, but I am wondering... When a user posts a shout it goes below the first shout. Like the auto_increment puts the ID up higher. I need it to go about the first shout, so like the auto_increment would invert. Someone told me this is possible through PHP. Is that true? and if so how do you do it? mysql_query('SELECT * FROM table ORDER BY increment_field DESC'); http://dev.mysql.com/doc/mysql/en/order-by-optimization.html or get all output from DB into array and use array_reverse(); http://us2.php.net/manual/pl/function.array-reverse.php If I do that... then i get this error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in myfile name on line 30 and on line 30 it says while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { I dont understand what is problem here... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] invert
you need to provide more information. we cannot tell what you are doing. you should: **PASTE THE RELEVANT SECTION OF YOUR CODE IN YOUR EMAIL** On Aug 25, 2005, at 2:38 PM, George B wrote: Łukasz 'nostra' Wojciechowski wrote: W odpowiedzi na maila (21:21 - 25 sierpnia 2005): I have written a shoutbox, and it works great, but I am wondering... When a user posts a shout it goes below the first shout. Like the auto_increment puts the ID up higher. I need it to go about the first shout, so like the auto_increment would invert. Someone told me this is possible through PHP. Is that true? and if so how do you do it? mysql_query('SELECT * FROM table ORDER BY increment_field DESC'); http://dev.mysql.com/doc/mysql/en/order-by-optimization.html or get all output from DB into array and use array_reverse(); http://us2.php.net/manual/pl/function.array-reverse.php If I do that... then i get this error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in myfile name on line 30 and on line 30 it says while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { I dont understand what is problem here... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php