Jump to content

Simple call from database


coupe-r

Recommended Posts

Hey guys.

 

Using the latest verions of PHP and mySQL

 

Heres the situation.

 

I have a index.php file which has multiple fields to fill in data.

Once this is done, it gets inserted into a database and a MemberID (Auto_Increment) is generated.  This is working fine.  Then you go to a Registration Successful page where I display the first and last name as well as the MemberID. Works good.

 

Now, the next page is supposed to continue to show the same memberID, but does not.  At one point, I had it showing 12345678.

 

This was because I had 8 users and it just listed them.

 

What I want is, if I have 1 user, member ID = 1

If i have 500 users, MemberID = 500.

 

Any suggestions?

 

 

Link to comment
Share on other sites

not sure how to use that.  here is the code

 

$DBConnect = @mysqli_connect("localhost", "root","btst")

Or die("<p>Unable to connect to the database server.</p>"

. "<p>Error code " . mysqli_connect_errno()

. ": " . mysqli_connect_error()) . "</p>";

 

$DBName = "project6";

$TableName = "memberreg";

 

@mysqli_select_db($DBConnect, $DBName)

Or die("<p>Unable to select the database.</p>"

. "<p>Error code " . mysqli_errno($DBConnect)

. ": " . mysqli_error($DBConnect)) . "</p>";

 

$sql = "SELECT COUNT(*) FROM $TableName";

$result = mysql_query($sql);

echo "$result";

 

But nothing happends

Link to comment
Share on other sites

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.