GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 26-Mar-2007, 15:38
markyp markyp is offline
New Member
 
Join Date: Nov 2006
Posts: 26
markyp is on a distinguished road

automatically assigning a number into the database from php


hi i have a form that submitts infrormation into the database i want to have something where by each time a user submitts a form they are assigned a number automatically into the database? nothing complex like guest no1
then next person guest number 2 etc . can some one tell me how i can do this an give an example if possible please

thanks
  #2  
Old 01-May-2007, 08:59
karnetics karnetics is offline
New Member
 
Join Date: May 2007
Posts: 10
karnetics is on a distinguished road

Re: automatically assigning a number into the database from php


Create and query to look at the number field within your db.. then
create a script that add one to the next number example
$sql = "SELECT num FROM DB ORDER BY num DESC";

// latest number within db
$num = $row['num'];

// set this number to enter in db for new user
$num = $num++;

I hope this is kind of what you are looking for.
  #3  
Old 01-May-2007, 09:12
camp185 camp185 is offline
New Member
 
Join Date: Sep 2006
Location: San Jose, CA
Posts: 6
camp185 is on a distinguished road

Re: automatically assigning a number into the database from php


Just create a new field in your table. Call it ID, and set to auto_increment. It will basically give an id number for every post.
 
 

Recent GIDBlog2nd Week of IA Training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting a number amount to text Godzilla CPP / C++ Forum 5 31-Mar-2006 11:38
Program Needed: Perfect Number Program in C language koool_kid C Programming Language 12 02-Dec-2005 14:02
Please help with functions... brookeville CPP / C++ Forum 36 05-Nov-2004 00:23
Anyone can write a program code for this??? chriskan76 C Programming Language 1 19-Oct-2004 20:25
Parsing PHP code that's stored in a database. JdS MySQL / PHP Forum 3 13-May-2004 09:15

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 19:24.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.