Alright, I cannot seem to connect to my godaddy.com database for the life of me. I'm pretty sure I'm just confused in all the syntax - any help would be great! The farthest I've gotten from online help is this:
Code:<?php //Sample Database Connection Syntax for PHP and MySQL. //Connect To Database $hostname="mysql.secureserver.net"; $username="your_dbusername"; $password="your_dbpassword"; $dbname="your_dbusername"; $usertable="your_tablename"; $yourfield = "your_field"; $connection = mysql_connect("$hostname", "$username", "$password"); mysql_select_db("$databasename", $con); # Check If Record Exists $query = "SELECT * FROM $usertable"; $result = mysql_query($query); if($result) { while($row = mysql_fetch_array($result)) { $name = $row["$yourfield"]; echo "Name: ".$name." "; } } ?>
I know that I replace username, password, and dbname. I don't actually have any tables.. so I'm not sure what to do with everything else - and also, did I need to change the $hostname?? I'm so lost - everything I try results in 'Error connecting to mysql database.' Thanx for any help.



Reply With Quote


Bookmarks