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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

connecting to MySQL database through php

  • 28-04-2005 10: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