You are here: Re: How to "fetch" a certain id? « All PHP « IT news, forums, messages
Re: How to "fetch" a certain id?

Posted by kenoli on 11/17/06 12:13

If you are using a mysql database, you can do the following at the time
you insert the person's record into the database to obtain the id:

$query = "INSERT INTO table (field_1, field_2) VALUES ('x', 'y', 'z')";
//insert record
$result = mysql_query ($query); // Run the query.
$tid = mysql_insert_id($result); //Get the id of the record just
inserted

This requires that the id field be auto-generated in the previous query
using an AUTO_INCREMENT attribute. If not, it will return a '0'.

casper christensen wrote:
> Hi
>
> When someone fills the form on my site, and id is created in my
> database. (see below)
>
>
> http://www.affiliatesjunction.net/directory.php?ax=out&id=XXX
>
>
> after submitting the form they are directed to a "thank you page". Now
> I need to show the above link in a textfield with the newly created id.
>
>
>
> How can I "fetch" this id from the database.?
>
>
> casper

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация