Jump to content

[SOLVED] Display Query


Hamish

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

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.