fwbbetsy Posted September 5, 2006 Share Posted September 5, 2006 I am trying to get this code to work but keep getting errors:<?$hostnm = "localhost";$usernm = "emeraldc_ustraff";$pwd = "emeraldc_ustraff";$dbName = "emeraldc_dbtraff";$site1="http://www.emeraldcoasttraffic.com";$data = mysql_query("SELECT * FROM "user")or die(mysql_error());Print "<table border cellpadding=3>";while($info = mysql_fetch_array( $data )){Print "<tr>";Print "<th>Name:</th> <td>".$info['name'] . "</td> ";Print "<th>Credits:</th> <td>".$info['credits'] . " </td></tr>";}Print "</table>";?>The error I get is:Parse error: parse error, unexpected T_STRING in /home/emeraldc/public_html/test.php on line 10Any help would be appricated.thanksBetsy Link to comment https://forums.phpfreaks.com/topic/19798-need-help-with-some-code-beginner/ Share on other sites More sharing options...
Stevis2002 Posted September 5, 2006 Share Posted September 5, 2006 [code]$data = mysql_query("SELECT * FROM "user")[/code]should be [code]$data = mysql_query("SELECT * FROM user)[/code]I think. Link to comment https://forums.phpfreaks.com/topic/19798-need-help-with-some-code-beginner/#findComment-86581 Share on other sites More sharing options...
ober Posted September 5, 2006 Share Posted September 5, 2006 A few things:1) don't put your table name in quotes: $data = mysql_query("SELECT * FROM user") or die(mysql_error());2) print is all lowercase Link to comment https://forums.phpfreaks.com/topic/19798-need-help-with-some-code-beginner/#findComment-86582 Share on other sites More sharing options...
fwbbetsy Posted September 5, 2006 Author Share Posted September 5, 2006 I changed it: <?$hostnm = "localhost";$usernm = "emeraldc_ustraff";$pwd = "emeraldc_ustraff";$dbName = "emeraldc_dbtraff";$site1="http://www.emeraldcoasttraffic.com";$data = mysql_query("SELECT * FROM user)or die(mysql_error());print "<table border cellpadding=3>";while($info = mysql_fetch_array( $data )){print "<tr>";print "<th>Name:</th> <td>".$info['name'] . "</td> ";print "<th>Credits:</th> <td>".$info['credits'] . " </td></tr>";}print "</table>";?>still getting an error but a different one:Parse error: parse error, unexpected T_STRING in /home/emeraldc/public_html/test.php on line 12thanksBetsy Link to comment https://forums.phpfreaks.com/topic/19798-need-help-with-some-code-beginner/#findComment-86588 Share on other sites More sharing options...
Stevis2002 Posted September 5, 2006 Share Posted September 5, 2006 Close the quotes..[code]$data = mysql_query("SELECT * FROM user)[/code]to[code]$data = mysql_query("SELECT * FROM user")[/code] Link to comment https://forums.phpfreaks.com/topic/19798-need-help-with-some-code-beginner/#findComment-86592 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.