schoolmommy Posted May 3, 2007 Share Posted May 3, 2007 Hi! I'm just getting started with the php and just started learning mysql. This is probably a very stupid question, but I'll ask anyway! I have made a table in mysql called "customer" I made my index page with the table to hold the info. and my php file with all of the connection info. (see below). I've tested the table by adding data. My stupid question is - how do I check the table to see if the data I input is there. In Access, I think you would just open the table and view the data. But as I've said, I don't know mysql. Help is always appreciatd! <body> <?php //Get data from form extract($_POST); //Check for blank if (($txtName == "") || ($txtemail == "") || ($txtusername == "") || ($txtpassword == "") || ($txtconfirmpass == "") || ($txtaddress == "") ($txtcity == "") || ($txtstate == "") || ($txtzip == "") || ($txtphone == "")) { header("Location: index.htm"); exit; } if ($txtpassword != $txtconfirmpass) { header("Location: index.htm"); exit; } $connect = @mysql_connect("localhost","****","*****") or die(mysql_error()); $db = @mysql_select_db("customer",$connect) or die(mysql_error()); $sql = "INSERT INTO customer VALUES ('$txtname','$txtemail', '$txtusername', '$txtpassword', '$txtaddress', '$txtcity', '$txtstate', '$txtzip', '$txtphone')"; $result = @mysql_query($sql,$db) or die(mysql_error()); ?> <?php echo "$result"; ?> </body> </html> ****username & password blanked out on purpose********* Quote Link to comment https://forums.phpfreaks.com/topic/49812-viewing-a-table-in-mysql/ Share on other sites More sharing options...
fenway Posted May 3, 2007 Share Posted May 3, 2007 You'll need to pull back the desired records with a select statement. Quote Link to comment https://forums.phpfreaks.com/topic/49812-viewing-a-table-in-mysql/#findComment-244457 Share on other sites More sharing options...
schoolmommy Posted May 3, 2007 Author Share Posted May 3, 2007 As I said, I'm very, very new to php & mysql. If I used a statement like: SELECT * FROM [customer];//name of table where do I put the code? Should it go before the $result=... statement? Outside the php? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/49812-viewing-a-table-in-mysql/#findComment-244496 Share on other sites More sharing options...
quillspirit Posted May 3, 2007 Share Posted May 3, 2007 This should be moved to .php help forum Quote Link to comment https://forums.phpfreaks.com/topic/49812-viewing-a-table-in-mysql/#findComment-244670 Share on other sites More sharing options...
fenway Posted May 3, 2007 Share Posted May 3, 2007 As I said, I'm very, very new to php & mysql. If I used a statement like: SELECT * FROM [customer];//name of table where do I put the code? Should it go before the $result=... statement? Outside the php? Thanks! You should read some of the tutorials on getting mysql & php to work together. Quote Link to comment https://forums.phpfreaks.com/topic/49812-viewing-a-table-in-mysql/#findComment-244722 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.