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
code: |
SELECT [fieldnames] FROM [database] ORDER BY RAND() LIMIT 1;
|
or in your case:
code: |
SELECT * FROM Chuck_Norris_sucks ORDER BY RAND() DESC LIMIT 1
|