Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

connecting to MySQL database through php

Options
  • 28-04-2005 11:59am
    #1
    Closed Accounts Posts: 4


    Hi,
    Im trying to write information from an on-line form to a mysql database using php. I am trying to write to a customer table, which references an addresses table and a credit card table.

    $titl=$_POST["title"];
    $fname=$_POST["firstname"];
    $sname=$_POST["surname"];
    $addr=$_POST["address"];
    $twn=$_POST["town"];
    $cty=$_POST["city"];
    $pcode=$_POST["postalcode"];
    $ctry=$_POST["country"];
    $phone=$_POST["telephone"];
    $mail=$_POST["email"];
    $ctyp=$_POST["cardType"];
    $cnum=$_POST["cardNumber"];
    $expmonth=$_POST["cardMonth"];
    $expyear=$_POST["cardYear"];

    I am able to write the above information to one big table: EG:

    $db->query("INSERT INTO Customer(title, firstname, surname, address, town, city, postalcode, country, telephone, email, cardType, cardNumber, cardMonth, cardYear)
    VALUES('$titl', '$fname','$sname', '$addr', '$twn', '$cty', '$pcode', '$ctry', '$phone', '$mail', '$ctyp', '$cnum', '$expmonth', '$expyear')");

    but am wondering what syntax is used to write to serveral tables using referencing?
    Thanks fro the help!


Comments

  • Closed Accounts Posts: 36 Caixa


    Probably a stupid question, but did you make sure that you changed these variables to the correct values?
    [php]
    define("EZSQL_DB_USER", ""); // <-- mysql db user
    define("EZSQL_DB_PASSWORD", "*******"); // <-- mysql db password
    define("EZSQL_DB_NAME", "*******"); // <-- mysql db pname
    define("EZSQL_DB_HOST", "localhost"); // <-- mysql server host[/php]


  • Closed Accounts Posts: 4 Sean2004


    @Caixa
    Thanks fro the help yesterday, was a silly problem which I figured out in the end


  • Registered Users Posts: 1,481 ✭✭✭satchmo


    If you post up a question and then figure out the answer yourself, you should post that up too in case anyone else comes looking with the same problem!


  • Closed Accounts Posts: 4 Sean2004


    Ok. There was a problem with the host so it wasnt on my part.


Advertisement