Jump to content

Viewing a table in mysql


schoolmommy

Recommended Posts

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*********

 

 

Link to comment
https://forums.phpfreaks.com/topic/49812-viewing-a-table-in-mysql/
Share on other sites

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.

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.