Parse error: syntax error, unexpected T_VARIABLE in /home/content/00/7882800/html/Connections/dueslogin.php on line 4 trying to connect to godaddy database and unable to connect due to php error. Have looked over the code and not able to figure out what is wrong.
<?php
//Variables for connecting to your database.
//These variable values come from your hosting account.
$hostname = "Squarepants.db.7882800.hostedresource.com";
$username = "Squarepants";
$dbname = "Squarepants";
//These variable values need to be changed by you before deploying
$password = "***********";
$usertable = "Spongebob";
$username = "username";
$password = "password";
//Connecting to your database
mysql_connect($hostname, $username, $password) OR DIE ("Unable to
connect to database! Please try again later.");
mysql_select_db($Squarepants);
//Fetching from your database table.
$query = "SELECT * FROM $usertable";
$result = mysql_query($query);
if ($result) {
while($row = mysql_fetch_array($result)) {
$name = $row["$yourfield"];
echo "Name: $name<br>";
}
}
?>
Connections/dueslogin.php
file, not the one posted. – erisco Oct 28 '12 at 3:41