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
https://forums.phpfreaks.com/topic/273799-php-sql-help-required/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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