Results 1 to 2 of 2

Thread: I'm getting these warnings

  1. #1
    Join Date
    Jan 2013

    I'm getting these warnings

    Trying to create in mySQL

    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:


    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]',

    LINE 14: $result = mysql_query($query) || die(mysql_error());



    I will be grateful for any help I can get.

    Thanks in advance!

  2. #2
    Join Date
    Aug 2004
    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());

    $dbc Visit($url); 
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center