RE: [PHP] parse error driving me nuts ...
Instead of if ((mysql_num_rows($result)) = 1) try if ((mysql_num_rows($result)) == 1) HTH Jon -Original Message- From: Andrew [mailto:[EMAIL PROTECTED]] Sent: 15 February 2001 15:34 To: [EMAIL PROTECTED] Subject: [PHP] parse error driving me nuts ... hi, can anyone help me spot the parse error? It's throwing up on the first "if" line, and for the life of me I cannot find it! :) tia, andrew ?php include("db_connect_params.inc"); $sql="select path from PHOTO where pid =1"; $link_id = mysql_connect($host, $usr, $pass); $result = mysql_db_query($database, $sql, $link_id) or die("no result"); if ((mysql_num_rows($result)) = 1) { $row=mysql_fetch_array($result); extract($row); echo "img src =\"$path\"/imgbr"; } else { if (!isset($ii)) $ii = 1; $i = 1; while($row=mysql_fetch_array($result)) { extract($row); $displayed[$i]=$path; echo "a href=\"$PHP_SELF?ii=$i\"$i/anbspnbsp"; $i++; } echo "img src =\"$displayed[$ii]\"/imgbr"; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] parse error driving me nuts ...
Try to use == instead of = Sorin Ifrim - Original Message - From: Andrew [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, February 15, 2001 5:33 PM Subject: [PHP] parse error driving me nuts ... hi, can anyone help me spot the parse error? It's throwing up on the first "if" line, and for the life of me I cannot find it! :) tia, andrew ?php include("db_connect_params.inc"); $sql="select path from PHOTO where pid =1"; $link_id = mysql_connect($host, $usr, $pass); $result = mysql_db_query($database, $sql, $link_id) or die("no result"); if ((mysql_num_rows($result)) = 1) { $row=mysql_fetch_array($result); extract($row); echo "img src =\"$path\"/imgbr"; } else { if (!isset($ii)) $ii = 1; $i = 1; while($row=mysql_fetch_array($result)) { extract($row); $displayed[$i]=$path; echo "a href=\"$PHP_SELF?ii=$i\"$i/anbspnbsp"; $i++; } echo "img src =\"$displayed[$ii]\"/imgbr"; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] parse error driving me nuts ...
hi, can anyone help me spot the parse error? It's throwing up on the first "if" line, and for the life of me I cannot find it! :) tia, andrew ?php include("db_connect_params.inc"); $sql="select path from PHOTO where pid =1"; $link_id = mysql_connect($host, $usr, $pass); $result = mysql_db_query($database, $sql, $link_id) or die("no result"); if ((mysql_num_rows($result)) = 1) Well I don't know if it will give a parse error or not, but you have made the oh way too common C error in your IF statement. if ((mysql_num_rows($result)) = 1) should be: if ((mysql_num_rows($result)) == 1) - John Vanderbeck - Admin, GameDesign -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] parse error driving me nuts ...
Jon, John, Ifrim, the == worked ... thank you!! gotta read up on it now :) Cameron, dropping the extra () did not work :( thanks for the suggestions folks! andrew -Original Message- From: Jon Haworth [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 15, 2001 10:38 AM To: '[EMAIL PROTECTED]'; '[EMAIL PROTECTED]' Subject: RE: [PHP] parse error driving me nuts ... Instead of if ((mysql_num_rows($result)) = 1) try if ((mysql_num_rows($result)) == 1) HTH Jon -Original Message- From: Andrew [mailto:[EMAIL PROTECTED]] Sent: 15 February 2001 15:34 To: [EMAIL PROTECTED] Subject: [PHP] parse error driving me nuts ... hi, can anyone help me spot the parse error? It's throwing up on the first "if" line, and for the life of me I cannot find it! :) tia, andrew ?php include("db_connect_params.inc"); $sql="select path from PHOTO where pid =1"; $link_id = mysql_connect($host, $usr, $pass); $result = mysql_db_query($database, $sql, $link_id) or die("no result"); if ((mysql_num_rows($result)) = 1) { $row=mysql_fetch_array($result); extract($row); echo "img src =\"$path\"/imgbr"; } else { if (!isset($ii)) $ii = 1; $i = 1; while($row=mysql_fetch_array($result)) { extract($row); $displayed[$i]=$path; echo "a href=\"$PHP_SELF?ii=$i\"$i/anbspnbsp"; $i++; } echo "img src =\"$displayed[$ii]\"/imgbr"; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] parse error driving me nuts ...
Jon, John, Ifrim, the == worked ... thank you!! gotta read up on it now :) Cameron, dropping the extra () did not work :( thanks for the suggestions folks! andrew Remember that '=' means assign what is on the right to what is on the left, whereby '==' means is what is on the left equal to what is on the right. C, and C based languages allow you to out an assignemtn statement even when you intend a relational expression. It is a very common pitfall. I know I have fallen into it in my C work many times :( - John Vanderbeck - Admin, GameDesign -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]