Jump to content

php - SQL help required


aty01

Recommended Posts

Hi

 

i have a issue which i am not able to solve

 

i am trying to insert members into an sql database via php but all i get is empty records. i get the message member inserted, but like i say in the sql all it shows is empty records

 

the code is as follows...

 

 

 

<html>

<head>

<title>Scotia Cruises registration</title>

</head>

<body>

<h1>Customer Registration</h1>

 

<?php

$customer_id=$_POST['customer_id'];

$customer_title=$_POST['customer_title'];

$customer_forename=$_POST['customer_forename'];

$customer_surname=strtoupper($_POST['customer_surname']);

$customer_address_1=$_POST['customer_address_1'];

$customer_address_2=$_POST['customer_address_2'];

$customer_town=$_POST['customer_town'];

$customer_postcode=$_POST['customer_postcode'];

$customer_age=$_POST['customer_age'];

$customer_country=$_POST['customer_country'];

$customer_telephone_number=$_POST['customer_telephone_number'];

$customer_email=$_POST['customer_email'];

$customer_password=$_POST['customer_password'];

@ $db = mysql_connect('****************************', '**********', '**********');

if (!$db)

{

echo 'Error: Could not connect to database. Please try again later.';

exit;

}

else

{

mysql_select_db('**********');

$query = "insert into customer(customer_id,customer_title,customer_forename,customer_surname,customer_address_1,customer_address_2,customer_town,customer_postcode,customer_age,customer_country,customer_telephone_number,customer_email,customer_password) values ('$customer_id','$customer_title','$customer_forename','$customer_surname','$customer_address_1','$customer_address_2','$customer_town','$customer_postcode','$customer_age','$customer_country','$customer_telephone_number','$customer_email','$customer_password')";

 

 

$result = mysql_query($query);

if ($result)

echo 'Member inserted';

else

echo 'Did not work';

}

?>

<p>Click <a href="manage_account.html">here</a> to return to the login page</font></p>

</body>

</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.