Jump to content

[SOLVED] Newbie Question


jfs0479

Recommended Posts

Hi,

I have a registration system on my website but i have encountered one problem. After the users sign up they are taken to another page where it connectes to the mysql db and inserts the data.Then that page also sends out an email saying thanks for registering with their details like the password. This is annoying becasue i have set the ID as an autoassigned integer in the mysql it will generate it automaticaly. What i need is to be able to show the new users what their id will be for their login but becasue it is assigned once its got to the database im not sure how i can attempt this. However im not sure if its possible but i dont know how a system can generate the next number in the sequence and show the people at the same time??? Please help  lol!

 

James

Link to comment
Share on other sites

im not favouring the username approach really but it is an option but yes i do have a password becasue curerently in the processing page i use the $_POST["password1"]; so that is fine to send to the users but the int isnt generated until its in the database if im right. So im strugggling to find a way round it to see if there is a way of displaying the number otherwise i will have to use the username feature

 

In response to your reply obewan this just shows the previous entry i think and your depending on users to enter the next one up but can you trust them to do that???

 

James

Link to comment
Share on other sites

once you insert the data you have to query it again to get the last record inserted

 

try this after the insert

 

<?php
$sql = "SELECT * FROM tablename ORDER BY id DESC LIMIT 1";
?>

 

This will get you the last record inserted

 

Ray

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.