jamesnshanice Posted February 6, 2009 Share Posted February 6, 2009 Im trying to upload a script to my website and i am having trouble with the mysql.... I have uploaded all of the files correctly and set permissions, then i go to the link to install (http://www.jobsearchusatoday.com/resume/siteadmin/index.php) and this is what i get instead of the form: Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket ' /usr/local/mysql-5.0/data/mysql.sock' (2) in /home/content/j/a/m/jamesnshanice/html/resume/connect.php on line 3 Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2)..... I called my hosting company (godaddy.com) and they said that i have to set the string in my msql. so i go to my connect.php file and it looks like this: <? // 'server' 'database_username' 'database_password' $connection = mysql_connect("localhost", "root", "") or die (mysql_error()); // 'database_name' $db = mysql_select_db("test", $connection) or die (mysql_error()); ?> Then i look at an example of what it is suppose to look like and it looks like this: <?php //Connect To Database $hostname='jamesnshanice.db.3773677.hostedresource.com'; $username='jamesnshanice'; $password='your password'; $dbname='jamesnshanice'; $usertable='your_tablename'; $yourfield = 'your_field'; mysql_connect($hostname,$username, $password) OR DIE ('Unable to connect to database! Please try again later.'); mysql_select_db($dbname); $query = 'SELECT * FROM $usertable'; $result = mysql_query($query); if($result) { while($row = mysql_fetch_array($result)){ $name = $row['$yourfield']; echo 'Name: '.$name; } } ?> I just dont understand this stuff at all.... And whats weird is i didnt have this problem last night when i logged of, but all of a sudden today the problem was there. does anyone know how to fix this? Quote Link to comment https://forums.phpfreaks.com/topic/144029-i-need-some-serious-mysql-help/ Share on other sites More sharing options...
fenway Posted February 6, 2009 Share Posted February 6, 2009 There is a sticky on this board that talks about this.... Quote Link to comment https://forums.phpfreaks.com/topic/144029-i-need-some-serious-mysql-help/#findComment-755818 Share on other sites More sharing options...
jamesnshanice Posted February 7, 2009 Author Share Posted February 7, 2009 Im trying to upload a script to my website and i am having trouble with the mysql.... I have uploaded all of the files correctly and set permissions, then i go to the link to install (http://www.jobsearchusatoday.com/resume/siteadmin/index.php) and this is what i get instead of the form: Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket ' /usr/local/mysql-5.0/data/mysql.sock' (2) in /home/content/j/a/m/jamesnshanice/html/resume/connect.php on line 3 Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2)..... I called my hosting company (godaddy.com) and they said that i have to set the string in my msql. so i go to my connect.php file and it looks like this: <? // 'server' 'database_username' 'database_password' $connection = mysql_connect("localhost", "root", "") or die (mysql_error()); // 'database_name' $db = mysql_select_db("test", $connection) or die (mysql_error()); ?> Then i look at an example of what it is suppose to look like and it looks like this: <?php //Connect To Database $hostname='jamesnshanice.db.3773677.hostedresource.com'; $username='jamesnshanice'; $password='your password'; $dbname='jamesnshanice'; $usertable='your_tablename'; $yourfield = 'your_field'; mysql_connect($hostname,$username, $password) OR DIE ('Unable to connect to database! Please try again later.'); mysql_select_db($dbname); $query = 'SELECT * FROM $usertable'; $result = mysql_query($query); if($result) { while($row = mysql_fetch_array($result)){ $name = $row['$yourfield']; echo 'Name: '.$name; } } ?> I just dont understand this stuff at all.... And whats weird is i didnt have this problem last night when i logged of, but all of a sudden today the problem was there. does anyone know how to fix this? Quote Link to comment https://forums.phpfreaks.com/topic/144029-i-need-some-serious-mysql-help/#findComment-756632 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.