wispas Posted February 21, 2007 Share Posted February 21, 2007 I got this code off a tutorial - copy and paste. look what it gives me. Please help me and tell me whats wrong. <? // Connect database include("connectdb.php"); // Get all records in all columns from table and put it in $result. $result=mysql_query("select * from phonebook"); /*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 "Name : $row['name'] <br/>"; echo "Email : $row['email'] <br/>"; echo "Tel : $row['tel'] <hr>"; } mysql_close(); ?> Error Message: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /homepages/44/d195205520/htdocs/freezer/select.php on line 13 Link to comment https://forums.phpfreaks.com/topic/39412-please-help-me-whats-wrong-with-this-code/ Share on other sites More sharing options...
Archadian Posted February 21, 2007 Share Posted February 21, 2007 Try this: // Output echo "ID : " . $row['id']; echo "Name : " . $row['name']; echo "Email : " . $row['email']; echo "Tel : " . $row['tel']; } ?> Link to comment https://forums.phpfreaks.com/topic/39412-please-help-me-whats-wrong-with-this-code/#findComment-190112 Share on other sites More sharing options...
wispas Posted February 21, 2007 Author Share Posted February 21, 2007 IT WORKED!!! YESSS. THANK YOU SO MUCH Archadian. Link to comment https://forums.phpfreaks.com/topic/39412-please-help-me-whats-wrong-with-this-code/#findComment-190116 Share on other sites More sharing options...
Archadian Posted February 21, 2007 Share Posted February 21, 2007 copy what is up there right now...i was typing too fast trying to copy and correct your code. Try again and let us know if it still doesn't work. You might have copied the code i posted but wasn't done correcting it. Link to comment https://forums.phpfreaks.com/topic/39412-please-help-me-whats-wrong-with-this-code/#findComment-190120 Share on other sites More sharing options...
wispas Posted February 21, 2007 Author Share Posted February 21, 2007 IT WORKED. THANK U!!! Link to comment https://forums.phpfreaks.com/topic/39412-please-help-me-whats-wrong-with-this-code/#findComment-190121 Share on other sites More sharing options...
Archadian Posted February 21, 2007 Share Posted February 21, 2007 no problem The ; HAS to be at the end of each line unless its a function or if statement or anything like that. echo "test"; //correct echo "test" ; //wrong Link to comment https://forums.phpfreaks.com/topic/39412-please-help-me-whats-wrong-with-this-code/#findComment-190124 Share on other sites More sharing options...
wispas Posted February 21, 2007 Author Share Posted February 21, 2007 By the way, how do i add in the br tags now to seperate the lines? Link to comment https://forums.phpfreaks.com/topic/39412-please-help-me-whats-wrong-with-this-code/#findComment-190126 Share on other sites More sharing options...
Archadian Posted February 21, 2007 Share Posted February 21, 2007 echo "ID : " . $row['id']; echo "<br>"; echo "Name : " . $row['name']; echo "<br>"; echo "Email : " . $row['email']; echo "<br>"; echo "Tel : " . $row['tel']; Link to comment https://forums.phpfreaks.com/topic/39412-please-help-me-whats-wrong-with-this-code/#findComment-190127 Share on other sites More sharing options...
wispas Posted February 21, 2007 Author Share Posted February 21, 2007 no problem The ; HAS to be at the end of each line unless its a function or if statement or anything like that. echo "test"; //correct echo "test" ; //wrong i see. Link to comment https://forums.phpfreaks.com/topic/39412-please-help-me-whats-wrong-with-this-code/#findComment-190129 Share on other sites More sharing options...
wispas Posted February 21, 2007 Author Share Posted February 21, 2007 echo "ID : " . $row['id']; echo "<br>"; echo "Name : " . $row['name']; echo "<br>"; echo "Email : " . $row['email']; echo "<br>"; echo "Tel : " . $row['tel']; THANK YOU SO MUCH! YOUR SUCH A GREAT HELP. Link to comment https://forums.phpfreaks.com/topic/39412-please-help-me-whats-wrong-with-this-code/#findComment-190131 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.