stublackett Posted February 18, 2008 Share Posted February 18, 2008 Hi, I'm getting a parse error on my script Looking for a bit of advice too, Whats the best way to output the data from the Database in a table format rather than using "br" Tags as it looks a lot neater in a table I think My script is : <?php //Make DB Connection to retrieve User Info mysql_connect($hostname, $db_user, $db_password)or die("cannot connect"); mysql_select_db($dbname)or die("cannot select DB"); //Query to retrieve User Info $query="SELECT username, fullname, level FROM $db_table"; $result=mysql_query($sql); //Show Results while ($result = mysql_fetch_array($query)) { echo "<br />Username : " .$result['username']. " <br /> Fullname : " .$result['fullname']." <br /> Userlevel : " .$result['level'].";} } ?> Error I'm getting is Parse Error : unexpected $end I've just checked to pair the "}"s but cannot see where I'm missing one Link to comment https://forums.phpfreaks.com/topic/91724-parse-error/ Share on other sites More sharing options...
Daniel0 Posted February 18, 2008 Share Posted February 18, 2008 Doesn't the syntax highlighting reveal it for you? Remove the last ." from the third last line. Link to comment https://forums.phpfreaks.com/topic/91724-parse-error/#findComment-469834 Share on other sites More sharing options...
darkfreaks Posted February 18, 2008 Share Posted February 18, 2008 you were missing a double quote <?php //Make DB Connection to retrieve User Info mysql_connect($hostname, $db_user, $db_password)or die("cannot connect"); mysql_select_db($dbname)or die("cannot select DB"); //Query to retrieve User Info $query="SELECT username, fullname, level FROM $db_table"; $result=mysql_query($sql); //Show Results while ($result = mysql_fetch_array($query)) { echo "<br />Username : " .$result['username']. " <br /> Fullname : " .$result['fullname']." <br /> Userlevel : " .$result['level']."";} ?> Link to comment https://forums.phpfreaks.com/topic/91724-parse-error/#findComment-469836 Share on other sites More sharing options...
stublackett Posted February 18, 2008 Author Share Posted February 18, 2008 The error is on line 14 I removed the { from the echo statement line still getting the same, Tried removing some {'s from here and there but no joy Link to comment https://forums.phpfreaks.com/topic/91724-parse-error/#findComment-469838 Share on other sites More sharing options...
wildteen88 Posted February 18, 2008 Share Posted February 18, 2008 The error is on line 14 I removed the { from the echo statement line still getting the same, Tried removing some {'s from here and there but no joy Ummm, the solution has been posted above by darkfreaks and Daniel0 Link to comment https://forums.phpfreaks.com/topic/91724-parse-error/#findComment-469840 Share on other sites More sharing options...
stublackett Posted February 18, 2008 Author Share Posted February 18, 2008 Many Thanks! Looks like I posted, Just after the solution Can anyone reccomend a good PHP Editor? I'm struggling away with Programmers File Editor at the moment Link to comment https://forums.phpfreaks.com/topic/91724-parse-error/#findComment-469842 Share on other sites More sharing options...
darkfreaks Posted February 18, 2008 Share Posted February 18, 2008 Jedit or PHPdesigner2007 Link to comment https://forums.phpfreaks.com/topic/91724-parse-error/#findComment-469843 Share on other sites More sharing options...
wildteen88 Posted February 18, 2008 Share Posted February 18, 2008 For suggestions of PHP editors to use please look in this thread. As the problem has been solved and to prevent this thread going off topic I will lock it Link to comment https://forums.phpfreaks.com/topic/91724-parse-error/#findComment-469847 Share on other sites More sharing options...
Recommended Posts