Page 1 of 1

MYSQL Connection Woes

Posted: Fri Sep 19, 2003 7:10 pm
by centipede
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:


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)) &#123;
			echo $line&#1111;"Caption"];
		&#125;
	?>
</body>
</html>

thanks!!!

Posted: Fri Sep 19, 2003 7:53 pm
by McGruff
What do you get if you substitute this in your code:

Code: Select all

<?php
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) 
{         
    echo '<pre>';    
    print_r($line);
    echo '</pre>';    
} 
?>