MYSQL Connection Woes
Posted: Fri Sep 19, 2003 7:10 pm
below is a test document i have created. i have been building a site locally for a few weeks now, and just bought space on 1t3, my url is http://entwork.com. everything works fine locally, but on the 1t3 server i can't seem to access my database. it may be a problem with the database itself, but i was wondering if anyone sees something within my code that might be the culprit. i know the user name is correct, there is no password, and the table does exist, and has data in it. here is the test document:
thanks!!!
Code: Select all
<html>
<head>
<title>test</title>
</head>
<body>
begin to call the db:
<br />
<?php
//connect to the server
$link = mysql_connect("localhost", "cent", "")
or die("Could not connect");
//select the database
mysql_select_db("dbtree") or die("Could not select database");
//run the query
$sQuery = "select * from tbltree";
$result = mysql_query($sQuery,$link) or die("Query failed");
echo extract(mysql_fetch_assoc($result));
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo $lineї"Caption"];
}
?>
</body>
</html>thanks!!!