Jump to content

syntax error, unexpected T_VARIABLE in


tobimichigan

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/169422-syntax-error-unexpected-t_variable-in/
Share on other sites

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?

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());

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.