bugmero Posted May 8, 2010 Share Posted May 8, 2010 Hi all , I have this code : <?php $dbuser=""; $dbpassword=""; $servername=""; $dbname=""; connecttodb($servername,$dbname,$dbusername,$dbpassword); function connecttodb($servername,$dbname,$dbuser,$dbpassword) { global $link; $link=mysql_connect ("$servername","$dbuser","$dbpassword"); if(!$link){die("Could not connect to MySQL");} mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error()); } $query="select * from swr_player" $rt=mysql_query($query); echo mysql_error(); while($nt=mysql_fetch_array($rt)){ echo "$nt[FName] $nt[Lname] $nt[FB]<br>"; } ?> The data for connection is entered correctly . But i get this error messege : Parse error: syntax error, unexpected T_VARIABLE in ................ line 18 Please help Thanks Quote Link to comment https://forums.phpfreaks.com/topic/201093-error-when-using-fetch_array/ Share on other sites More sharing options...
JAY6390 Posted May 8, 2010 Share Posted May 8, 2010 Missing a semicolon at the end of this line $query = "select * from swr_player" should be $query = "select * from swr_player"; Quote Link to comment https://forums.phpfreaks.com/topic/201093-error-when-using-fetch_array/#findComment-1055012 Share on other sites More sharing options...
bugmero Posted May 8, 2010 Author Share Posted May 8, 2010 Thanks for the help , that did it, so many details you have to watch for . Quote Link to comment https://forums.phpfreaks.com/topic/201093-error-when-using-fetch_array/#findComment-1055015 Share on other sites More sharing options...
PFMaBiSmAd Posted May 8, 2010 Share Posted May 8, 2010 so many details you have to watch for Actually, the syntax rules of any computer programming language are much simpler and consistent than the syntax rules of a written linguistic language, but you do need to proofread your code to make sure it has the correct syntax everywhere. Quote Link to comment https://forums.phpfreaks.com/topic/201093-error-when-using-fetch_array/#findComment-1055021 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.