When I run this script on f2s.com it doesn't work, I have been up all night and wondering if I'm dumb or my host is dumb. All the database stuff works fine, just no script I can run on the site connecting to the DB will work.
I haven't programmed in PHP for awhile so I'm wondering if its me or not.
I get an error sayingPHP Code:<?php
//connection to the db
$host="db.nanaimo-online.f2s.com:3306";
$user="user";
$pass="pass";
$db="db";
$conn = @mysql_connect("$host", "$user", "$pass");
if (!$conn) {
print ("<p>Unable to make a connection to the server at this time.</p>");
exit();
}
mysql_select_db("$db");
if (! @mysql_select_db("$db")) {
print ("<p>Unable to connect to the database at this time.</p>");
exit();
}
// connection is made
$sql = "select * from calgary";
$result = "mysql_query($sql);
while($row = mysql_fetch_array($result)){
$id = $row["id"];
echo "$id";
}
?>
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /web/sites/221/nanaimo/www.nanaimo-online.f2s.com/testcalgary.php on line 28
Line 28 = $id = $row["id"];
There is a field in the table that is named "id". Now I just don't know whats wrong!
![]()





Bookmarks