Jump to content

Recommended Posts

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

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

Guest
This topic is now 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.