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
https://forums.phpfreaks.com/topic/99122-simple-call-from-database/
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

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.