Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

connecting to MySQL database through php

  • 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, Registered Users 2 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