sr20rps13 Posted February 5, 2007 Share Posted February 5, 2007 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 More sharing options...
papaface Posted February 5, 2007 Share Posted February 5, 2007 Just incase, it is mysql_select_db ('customr_data'); and not mysql_select_db ('customer_data'); ?? Spelling... Link to comment https://forums.phpfreaks.com/topic/37215-solved-mysql-data-base-not-selecting/#findComment-177790 Share on other sites More sharing options...
sr20rps13 Posted February 5, 2007 Author Share Posted February 5, 2007 Nope, check in phpMyAdmin. It is customr_data. Link to comment https://forums.phpfreaks.com/topic/37215-solved-mysql-data-base-not-selecting/#findComment-177792 Share on other sites More sharing options...
sr20rps13 Posted February 5, 2007 Author Share Posted February 5, 2007 Oh what a silly mistake I've made!!! Turns out customr_data is the table name, not the database name. I feel so stupid right now. Link to comment https://forums.phpfreaks.com/topic/37215-solved-mysql-data-base-not-selecting/#findComment-177795 Share on other sites More sharing options...
papaface Posted February 5, 2007 Share Posted February 5, 2007 Easy mistake to make, ive done it a few times. Remember to mark this as solved. Link to comment https://forums.phpfreaks.com/topic/37215-solved-mysql-data-base-not-selecting/#findComment-177797 Share on other sites More sharing options...
sr20rps13 Posted February 6, 2007 Author Share Posted February 6, 2007 how do I do that? Link to comment https://forums.phpfreaks.com/topic/37215-solved-mysql-data-base-not-selecting/#findComment-177835 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.