coupe-r Posted April 2, 2008 Share Posted April 2, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/99122-simple-call-from-database/ Share on other sites More sharing options...
zenag Posted April 2, 2008 Share Posted April 2, 2008 try this ... select count(*) from tablename Quote Link to comment https://forums.phpfreaks.com/topic/99122-simple-call-from-database/#findComment-507172 Share on other sites More sharing options...
coupe-r Posted April 2, 2008 Author Share Posted April 2, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/99122-simple-call-from-database/#findComment-507195 Share on other sites More sharing options...
aschk Posted April 2, 2008 Share Posted April 2, 2008 $result is not the result. It's merely a mysqli container for the result, you need to use mysqli_fetch_assoc() and get the column out of the returning array. Quote Link to comment https://forums.phpfreaks.com/topic/99122-simple-call-from-database/#findComment-507437 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.