Jump to content

Recommended Posts

Hi All,

 

I am trying to select all from and display result in table form on screen, then to link to an update query.

I am getting the following error

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING on from the following line

 

echo "id : $row['id'] <br/>";

 

The script is a copy and paste from PHP Simple only making changes to the record names.

Any help would be much appreciated.

 

Hamish

 

<code>

<?

// Connect database

include("opendbincludeA.php");

 

// Get all records in all columns from table and put it in $result.

$result=mysql_query("select * from User");

 

/*Split records in $result by table rows and put them in $row.

Make it looping by while statement. */

while($row=mysql_fetch_assoc($result)){

// Output

echo "id : $row['id'] <br/>";

echo "password : $row['password'] <br/>";

echo "name : $row['name'] <hr>";

 

// Add a link with a parameter(id) and it's value.

echo '<a href="update.php?id='.$row['id'].'">Update</a>';

 

}

 

mysql_close();

?>

 

Link to comment
https://forums.phpfreaks.com/topic/48433-solved-display-query/
Share on other sites

Hi,

 

Made changes as suggested

 

echo "id : ".$row['id'];

echo "password : ".$row['password'];

echo "name : ".$row['name'];

 

But am still getting the same error message from first line echo "id : ".$row['id'];

T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING

 

Hamish

Link to comment
https://forums.phpfreaks.com/topic/48433-solved-display-query/#findComment-236818
Share on other sites

The error messsge identifies the line number where the php parser 'chokes', not necessarily the line where the error originates, so the real mistake is in som earlier code.  If your code is exactly as quoted here, I'd suggest you have an error in the file that's included. Check that one carefully.

Link to comment
https://forums.phpfreaks.com/topic/48433-solved-display-query/#findComment-236830
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.