Computer Science Canada Need help regarding this simple PHP/MySQL script |
Author: | Velius [ Tue Mar 06, 2007 5:16 pm ] |
Post subject: | Need help regarding this simple PHP/MySQL script |
http://www.braffo.com/SPARTA.zip <=Link to my code This program is suppose to add a "fact" to the database, but I get an error on line 6 stating I cant reassign $this on line 6. If anyone could help me out, it would be much appreciated. Another question, how can I echo out a random entry from the DB table? |
Author: | PaulButler [ Tue Mar 06, 2007 6:51 pm ] | ||||
Post subject: | Re: Need help regarding this simple PHP/MySQL script | ||||
Velius @ Tue Mar 06, 2007 5:16 pm wrote: http://www.braffo.com/SPARTA.zip <=Link to my code
This program is suppose to add a "fact" to the database, but I get an error on line 6 stating I cant reassign $this on line 6. $this is a special variable in PHP that refers to the current object. Use another variable name. Velius @ Tue Mar 06, 2007 5:16 pm wrote: Another question, how can I echo out a random entry from the DB table? Order them by the RAND() function
or in your case:
|
Author: | Velius [ Tue Mar 06, 2007 10:02 pm ] | ||||||
Post subject: | Re: Need help regarding this simple PHP/MySQL script | ||||||
Thanks alot for your help~ but now I have a second problem. Whenever I try to add a fact here... http://braffo.com/guest.php Nothing happens, the fact counter doesnt go up like it should (its not writing anything to the DB), and my suspicion is that it has something to deal with the post script. Even if I type nothing, I dont get an error message like I should be getting.
here's the second part
The output of the code is "SELECT * FROM Chuck_Norris_sucks ORDER BY RAND() DESC LIMIT 1". Something tells me I dont have the right idea. Again, sorry for my noobishness. D: |
Author: | octopi [ Tue Mar 06, 2007 10:47 pm ] | ||
Post subject: | Re: Need help regarding this simple PHP/MySQL script | ||
you need to use to execute your query, then you can access the valus returned from something like
|