tobimichigan Posted August 9, 2009 Share Posted August 9, 2009 Hi again code gurus, Please could some help point where this code might be wrong? thanks~ <?php $pfno=$_GET["pfno"]; $query=mysql_query("Select * From user_table where no='$no'") or die (mysql_error()); $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $f1=mysql_result($result,$i,"lname"); $f2=mysql_result($result,$i,"fname"); $f3=mysql_result($result,$i,"oname"); $f4=mysql_result($result,$i,"department"); $pfno = mysql_fetch_assoc($result); echo "<p> PFNO : ".$_SESSION["no"]. "<p>Logged in: " .date("m/d/Y", $_SESSION["valid_time"]); echo("<p> Welcome" $f1); echo("Department:" $f3); $i++; ?> Its indicating that there's a syntax error on: line 37 which is ->echo("<p> Welcome" $f1); It says: Parse error: syntax error, unexpected T_VARIABLE in line 37 where on earth is this unexpected T_Variable? Quote Link to comment https://forums.phpfreaks.com/topic/169422-syntax-error-unexpected-t_variable-in/ Share on other sites More sharing options...
.josh Posted August 9, 2009 Share Posted August 9, 2009 http://www.w3schools.com/PHP/php_syntax.asp Quote Link to comment https://forums.phpfreaks.com/topic/169422-syntax-error-unexpected-t_variable-in/#findComment-893889 Share on other sites More sharing options...
chanfuterboy Posted August 9, 2009 Share Posted August 9, 2009 the scripts dont get till that line so? Quote Link to comment https://forums.phpfreaks.com/topic/169422-syntax-error-unexpected-t_variable-in/#findComment-893891 Share on other sites More sharing options...
chanfuterboy Posted August 9, 2009 Share Posted August 9, 2009 $pfno = mysql_fetch_assoc($result); echo "<p> PFNO : ".$_SESSION["no"]. "<p>Logged in: " .date("m/d/Y", $_SESSION["valid_time"]); echo("<p> Welcome$f1"); echo("Department:$f3" ); $i++; ?> Quote Link to comment https://forums.phpfreaks.com/topic/169422-syntax-error-unexpected-t_variable-in/#findComment-893892 Share on other sites More sharing options...
MadTechie Posted August 9, 2009 Share Posted August 9, 2009 echo("<p> Welcome".$f1); //update (concat string) echo("Department:".$f3); //update (concat string) $i++; } //Add (end the while block) Quote Link to comment https://forums.phpfreaks.com/topic/169422-syntax-error-unexpected-t_variable-in/#findComment-893895 Share on other sites More sharing options...
tobimichigan Posted August 9, 2009 Author Share Posted August 9, 2009 Yea, thanks Guys that worked but now, it seems to be giving an array error: Here's the code: $pfno=$_GET["pfno"]; $query=mysql_query("Select * From user_table where pfno='$pfno'") or die (mysql_error()); $result=mysql_query($query); $num=mysql_numrows($result); echo "<p> PFNO : ".$_SESSION["pfno"]. "<p>Logged in: " .date("m/d/Y", $_SESSION["valid_time"]); $i=0; while ($i < $num) { $f1=mysql_result($result,$i,"lname"); $f2=mysql_result($result,$i,"fname"); $f3=mysql_result($result,$i,"oname"); $f4=mysql_result($result,$i,"department"); $pfno = mysql_fetch_assoc($result); echo("<p> Welcome".$f1); echo ("Department:".$f3); $i++; } ?> "Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in line 25 Where line 25 is ->this $num=mysql_numrows($result); . Please guys any further pointer to this error? Quote Link to comment https://forums.phpfreaks.com/topic/169422-syntax-error-unexpected-t_variable-in/#findComment-894027 Share on other sites More sharing options...
MadTechie Posted August 9, 2009 Share Posted August 9, 2009 No your existing code is giving that error $query=mysql_query("Select * From user_table where pfno='$pfno'") or die (mysql_error()); $result=mysql_query($query); should be $result=mysql_query("Select * From user_table where pfno='$pfno'") or die (mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/169422-syntax-error-unexpected-t_variable-in/#findComment-894226 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.