jtjtjthey Posted August 28, 2008 Share Posted August 28, 2008 Hi guys! I'm having a new problem regarding posting an edited record in edit_form.php where the page contains mysql update functionality. For me, I seems to have no problem for mysql database connection in conncection.php dunno what to do with my coding as I have no idea regarding the problem shown as below: Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'localhost' (10048) in C:\Program Files\xampp\htdocs\notification_system\connection\connection.php on line 8 Could not connect: Can't connect to MySQL server on 'localhost' (10048) The Update form coding is shown in below: include("../connection/connection.php"); $error0=$_GET['error0']; $checkbox[$i]=$_POST['ID']; $error1=$_GET['error1']; $edit=$_POST['edit']; $cancel=$_POST['cancel']; if($cancel) { header("Location:admin_main_page.php"); } else { if($checkbox[$i]) { $sql0="SELECT * FROM directory WHERE id = '$checkbox[$i]'"; $result0=mysql_query($sql0,$con); $num=mysql_fetch_array($result0); ?> <? } else { header("Location:edit_form.php?error3=1"); } ?> Quote Link to comment Share on other sites More sharing options...
trq Posted August 28, 2008 Share Posted August 28, 2008 And the contents of connection.php are? Quote Link to comment Share on other sites More sharing options...
jtjtjthey Posted August 28, 2008 Author Share Posted August 28, 2008 And the contents of connection.php are? Hi thorpe thanks for reading my post. The connection.php code is shown in below: <?php // connect to database $server_name = "localhost"; $host_name = "root"; $password = ""; $database = "notification_sys"; $con = mysql_connect($server_name,$host_name,$password); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db($database, $con); ?> Quote Link to comment Share on other sites More sharing options...
trq Posted August 28, 2008 Share Posted August 28, 2008 Make sure you have the correct $server_name, $host_name and $password set. Quote Link to comment Share on other sites More sharing options...
jtjtjthey Posted August 28, 2008 Author Share Posted August 28, 2008 Make sure you have the correct $server_name, $host_name and $password set. Hi thorpe: Since the system is kinda small so I just set $server_name, $host_name and $password as default. Quote Link to comment Share on other sites More sharing options...
jtjtjthey Posted August 28, 2008 Author Share Posted August 28, 2008 Make sure you have the correct $server_name, $host_name and $password set. The $server_name, $host_name and $password set are actually correct as it is also used for add and delete in another php page. Quote Link to comment Share on other sites More sharing options...
dmg Posted January 24, 2010 Share Posted January 24, 2010 Did you ever solve this issue? I have the same problem Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted January 24, 2010 Share Posted January 24, 2010 What is your exact error message because your problem might or might not be the same? The error message in the first post in the thread means that there is no mysql server running on the localhost computer or it is not listening on the default port number. Are you doing this on your localhost computer and your know that you have a mysql server installed, it is running, and it is listening on the default port number 3306? Quote Link to comment 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.