Warning: mysql_query() [function.mysql-query]: Can't connect to MySQL server on 'localhost' (10061) in D:\Hosting\5704590\html\studentemail_form.php on line 14
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in D:\Hosting\5704590\html\studentemail_form.php on line 14
Can't connect to MySQL server on 'localhost' (10061)
This is my code:
<?php
function Visit($url)
{
$dbc = mysql_connect(); // set this to connect properly
echo $url;
mysql_select_db('40daysintheword', $con) || die(mysql_error());
}
$query = "INSERT INTO $table(host,firstname, lastname, address, city, phone, email, member childcare, grades)
VALUES('$_POST[host]', '$_POST[firstname]', '$_POST[lastname]', '$_POST[address]', '$_POST[city]', '$_POST[phone]', '$_POST[email]', '$_POST[member]', '$_POST[childcare]',
'$_POST[grades]";
LINE 14: $result = mysql_query($query) || die(mysql_error());
If you are connecting to the DB via your Visit() function, if you don't return the mysql resource from it, then it will exist only within that function. You could maybe change it to something like:
PHP Code:
function Visit($url) { $dbc = mysql_connect(); // <--- are you setting the dbHost and user/password params here? mysql_select_db('40daysintheword', $con) || die(mysql_error()); return $dbc; }
$dbc = Visit($url);
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks