Random SQL Entry

I am trying to acess a random SQL entry, Am I taking the right approach on this? and if so why am I getting this error.

Parse error: syntax error, unexpected '=', expecting ',' or ';' in /home/bizcards/public_html/sltrinkets.com/Store/test.php on line 8

heres the php script im using, its probably syntax, thats wha im worst at. Tanks for any help!

[php]

<?php include '../include/mysql.php'; $link = mysql_connect("$host", "$user", "$pass") or die(mysql_error()); mysql_select_db("$database", $link) or die(mysql_error()); $SQL = "SELECT * FROM FEATPRODS ORDER BY RAND() LIMIT 1"; $resultt = mysql_query( $SQL ) or die(mysql_error()); $rowF12 = mysql_fetch_array($resultt); echo = $rowF12['PNUMBER']; ?>

[/php]

line 8:
echo = $rowF12[‘PNUMBER’];

echo is like a function: echo($rowF12[‘PNUMBER’]);
the special thing is that u can leave the brakets away: echo $rowF12[‘PNUMBER’];
but u cant asign anything to it.

anything at the left of ‘=’ has to be a variable. echo is not a variable!

http://php.net/echo
http://php.net/operators.assignment

Sponsor our Newsletter | Privacy Policy | Terms of Service