Hamish Posted April 24, 2007 Share Posted April 24, 2007 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(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/48433-solved-display-query/ Share on other sites More sharing options...
dsaba Posted April 24, 2007 Share Posted April 24, 2007 echo "id : $row['id'] "; I believe you have to concactate variables in your echo statements echo 'id : '.$row['id']; or echo "id : ".$row['id']; Quote Link to comment https://forums.phpfreaks.com/topic/48433-solved-display-query/#findComment-236806 Share on other sites More sharing options...
Hamish Posted April 24, 2007 Author Share Posted April 24, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/48433-solved-display-query/#findComment-236818 Share on other sites More sharing options...
AndyB Posted April 24, 2007 Share Posted April 24, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/48433-solved-display-query/#findComment-236830 Share on other sites More sharing options...
phpbeginner Posted April 24, 2007 Share Posted April 24, 2007 Try changing this <? // Connect database include("opendbincludeA.php" to <?php // Connect database include("opendbincludeA.php" Quote Link to comment https://forums.phpfreaks.com/topic/48433-solved-display-query/#findComment-236998 Share on other sites More sharing options...
Hamish Posted April 24, 2007 Author Share Posted April 24, 2007 Hi All, Thanks to all Problem now solved. Regards Hamish Quote Link to comment https://forums.phpfreaks.com/topic/48433-solved-display-query/#findComment-237365 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.