Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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