Jump to content

[SOLVED] mySQL data base not selecting...


sr20rps13

Recommended Posts

This is gettin real annoying...

 

mysql_connect.php

<?php
$conn = mysql_connect( 'localhost', '****', '**********') or die (mysql_error());
mysql_select_db ('customr_data');
?> 

 

customer_data_form.php

<html>
<head>
<title>Add new customer info.</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
if(isset($_POST['add']))
{

include 'mysql_connect.php';

$First_name = $_POST['first_name'];
$Last_name = $_POST['last_name'];
$Address = $_POST['address'];
$Phone_number = $_POST['phone_number'];
$Email = $_POST['email'];

$query = "INSERT INTO customr_data
(first_name, last_name, address, phone_number, email)
values
('$First_name', '$Last_name','$Address','$Phone_number', '$Email')";
mysql_query($query) or die (mysql_error());

$query = "FLUSH PRIVILEGES";
mysql_query($query) or die (mysql_error());

include 'mysql_close.php';
echo "New customer added";
}
else
{
?>

<form method="post">
<table width="400" border="0" cellspacing="1" cellpadding="2">
<tr> 
<td width="100">First name</td>
<td><input name="first_name" type="text" id="first_name"></td>
</tr>
<tr> 
<td width="100">Last name</td>
<td><input name="last_name" type="text" id="last_name"></td>
</tr>
<tr> 
<td width="100">Address</td>
<td><input name="address" type="text" id="address"></td>
</tr>
<tr> 
<td width="100">Phone Number</td>
<td><input name="phone_number" type="text" id="phone_number"></td>
</tr>
<tr> 
<td width="100">Email</td>
<td><input name="email" type="text" id="email"></td>
</tr>
<tr> 
<td width="100"> </td>
<td> </td>
</tr>
<tr> 
<td width="100"> </td>
<td><input name="add" type="submit" id="add" value="Add customer"></td>
</tr>
</table>
</form>
<?php
}
?>
</body>
</html>

 

Please check my code and tell me what I am doing wrong

Link to comment
https://forums.phpfreaks.com/topic/37215-solved-mysql-data-base-not-selecting/
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.