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
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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.