Jump to content

oxhey

New Members
  • Posts

    3
  • Joined

  • Last visited

oxhey's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have this query : $sql ="SELECT * FROM card c JOIN driver d ON c.referred_as=d.referred_as WHERE d.ID='$id'"; It needs to be updated to include the 3rd table which is a joined table containing the driver and card id's from their respective tables. Table 1 is called "card" . The fields that are important are: "state_id" - This table has 3 values (1,2,3) "associated_driver" - called "referred_as" on driver table // Not actually part of the table . Created by the 3rd table "referred_as" - called "associated_card" on driver table Table 2 is called "driver". The fields that are important are: "ID" - The auto incremented value of the table "associated_card" - Has a value , normally some number e.g 123555 // Not actually part of the table . Created by the 3rd table "referred_as" - The name of the driver () called "associated_driver" on card table Forgot to add this table : Table 3 is called "card_driver". The fields that are important are: "driver_id" - The id from the driver table that links to the card "card_id" - The id from the card table that links to the driver What i want to happen : When a user enters their id from the driver table, it will compare a field that both tables have i.e the 'associated card' field (called referred_as on the card table). The associated card is from the joined table which i dont know how to get into the query. Any help is welcomed. If you need me to explain it more , i will.
  2. I have three tables tables : Table 1 is called "card" . The fields that are important are: - "state_id" - This table has 3 values (1,2,3) - "associated_driver" - Has a text value e.g John Smith - "referred_as" - Has a value , normally some number e.g 123555 Table 2 is called "entrylog" . The fields that are important are: - "ID" - The auto incremented value of the table. - "driver_id" - The value that links it to the ID filed of the driver table. Table 3 is called "driver". The fields that are important are: - "ID" - The auto incremented value of the table - "associated_card" - Has a value , normally some number e.g 123555 - "referred_as" - The name of the driver I already have a field where the user can enter data (the entrylog ID), and a way to do the query . I just need to get the actual query correct. What I want the MySQL query to do: When a user enters an ID (from one of the entry's in the entrylog table) , the query compares the driver_id value to the value of ID on the driver table. When it finds a match , it then compares the value of the associated _card and referred_as (from the driver table ) to referred_as and associated_driver (from the card table). When those are verified as being the same , it then looks to the state_id field for that entry that has just been verified . It returns the value of state id . Its a bit confusing , I know. I have posted code for what I have now (the query is totally wrong , but it shows how the result is checked. ) Thanks in advance. $id = $_POST['id']; $sql ="SELECT * FROM card WHERE id = '$id'" ; mysql_select_db('damp'); $result = mysql_query( $sql, $conn ); $row = mysql_fetch_assoc($result); switch($row['state_id']) { case "1": echo "<strong><font color=\"green\">Authorisation Granted!</font></strong>"; break; case "2": echo "<strong><font color=\"red\">Your card has expired and authorisation is denied</font></strong>"; break; case "3": echo "<strong><font color=\"red\">Your card has been cancelled and authorisation is denied</font></strong>"; break; default: echo "<strong><font color=\"red\">The Card ID does not exist</font></strong>"; }
  3. Iv got the stripe checkout button working with its own static fields. Iv got a form which I want to pass the name , email and amount data to the stripe charge page. the amount is calculated and stored in this variable : grand_total here is the code for the charge page : <?php require_once(dirname(__FILE__) . '/config.php'); $token = $_POST['stripeToken']; $customer = Stripe_Customer::create(array( "email" => 'email', "card" => $token, )); $charge = Stripe_Charge::create(array( 'customer' => $customer->id, 'amount' => 2499, 'currency' => 'usd' )); echo '<h1>Successfully charged $24.99!</h1><br/>'; $_SESSION['stripeToken'] = $token; ?> Here is the code for the form fields : <div class="formfield"><label for="Name" class="formlabel">Name</label><input type="text" name="Name" id="Name" size="50" /></div> <div class="formfield"><label for="Email_Address" class="formlabel">Email</label><input type="text" name="Email_Address" id="Email_Address" size="50" /></div> Thanks for the help
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.