see mysql_insert_id($link_identifier)
-- rylin
Patrik Fomin wrote:
Hi,
im adding a post to the database, is there any way to retrive back the ID
for the post that i just created?
the id is auto_increment and primary key.
like
$sql = insert into test (namn, www) values('test', 'test.com');
There's two methods I use, depending on the situations I need.
What it sounds like you want is this:
$sql = SELECT id FROM test ORDER BY id DESC LIMIT 1;
Often when I need to know the next avaliable ID prior to making an insert,
I'll do this--
$sql =SHOW TABLE STATUS LIKE 'test';
$array =
Just a correction you can use arrays with querystrings
page.php?var1[]=firstvar1[]=secondvar1[]=third
$var1
Array
(
[0] = first
[1] = second
[2] = third
)
OR
page.php?var1[]=firstvar2[2]=secondvar2[]=third
$var 1
Array
(
[0] = first
)
$var2
Array
(
[2] = second
/a';
then on link.php you'd have the array $array[] (with globals) or
$_GET['array'][]
cool
Beau
-Original Message-
From: Adam Royle [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 10 July 2002 9:05 PM
To: Beau Lebens; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] A Simple Question
Just
Suppose you are using PHP.
A link like this:
http://yourdomain.com/yourpage.php?var1=value1var2=value2var3=value3
will do the trick.
And in the page that receives this link (yourpage.php that is), use $_GET[]
to get the value:
$var1 = $_GET[var1];
$var2 = $_GET[var2];
$var3 = $_GET[var3];
Message-
// From: Tony [mailto:[EMAIL PROTECTED]]
// Sent: Wednesday, 10 July 2002 7:42 AM
// To: Manuel; [EMAIL PROTECTED]
// Subject: Re: [PHP-DB] A Simple Question
//
//
// Suppose you are using PHP.
// A link like this:
//
// http://yourdomain.com/yourpage.php?var1=value1var2=value2va
// r3
4. Be careful with the $_GET[] array that Tony mentions, it is only
available on more recent versions of PHP, before that it was
$HTTP_GET_VARS
and a lot of people had been using just plain $var1 or whatever, assuming
that register_globals would always be ON in the php.ini file (which also
Hi Brad,
Your parameter is named $title and you are converting a variable called $input to an
array.
You could catch this type of errors if you change the setting for error_reportiong in
php.ini.
- Frank
can somebody help me with the following code:
function multi_word($title) {