CageyJ0nnY Posted May 12, 2010 Share Posted May 12, 2010 Hello! i am creating a page that connects to an online database that I have set up. I cannot seem to connect however and as i am new to this the problem is not obvious to me... Heres the code i have used: <?php $conn = mysql_connect(“jjennings3db.bimserver2.com”, “jjennings3db”, “bullet1238”); mysql_select_db("jjennings3db", $conn); $sql = "SELECT * FROM tblProperties"; echo "Properties Availible:<br>"; $result = mysql_query($sql, $conn); while ($array = mysql_fetch_array($result)) { echo "<p>Property Name: " . $array[PropertyName] . "<br>"; "</p>"; } ?> Thankyou for any assistance you are able to give. Jonny Link to comment https://forums.phpfreaks.com/topic/201472-database-connection-help/ Share on other sites More sharing options...
JAY6390 Posted May 12, 2010 Share Posted May 12, 2010 Are you sure that the remote server allows connections? Do you get any errors? Link to comment https://forums.phpfreaks.com/topic/201472-database-connection-help/#findComment-1057013 Share on other sites More sharing options...
CageyJ0nnY Posted May 12, 2010 Author Share Posted May 12, 2010 yes, the site has been specifically set up for the task. The errors i get are: Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host '“jjennings3dbbimserver2com”' (2) in /home/jjennings3/jjennings3.bimserver2.com/home-ltd.php on line 3 Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/jjennings3/jjennings3.bimserver2.com/home-ltd.php on line 5 Properties Availible: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/jjennings3/jjennings3.bimserver2.com/home-ltd.php on line 11 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/jjennings3/jjennings3.bimserver2.com/home-ltd.php on line 13 Link to comment https://forums.phpfreaks.com/topic/201472-database-connection-help/#findComment-1057014 Share on other sites More sharing options...
JAY6390 Posted May 12, 2010 Share Posted May 12, 2010 change the line to $conn = mysql_connect('jjennings3db.bimserver2.com', 'jjennings3db', 'bullet1238'); Also if these are the correct credentials for the database you should change them as you've just posted them on a public forum Link to comment https://forums.phpfreaks.com/topic/201472-database-connection-help/#findComment-1057015 Share on other sites More sharing options...
CageyJ0nnY Posted May 12, 2010 Author Share Posted May 12, 2010 thankyou! the details have been changed from the original detials, ill give the code you posted a try. Link to comment https://forums.phpfreaks.com/topic/201472-database-connection-help/#findComment-1057016 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.