> Date: Sun, 19 Apr 2009 23:19:56 +0100
> From: andy-li...@networkmail.eu
> To: defati...@hotmail.com
> CC: mysql@lists.mysql.com
> Subject: Re: Need help with mysql prob
> 
> Hi Alugo,
> > Hi Andy,
> >
> > Thanks for your prompt response. However, since tbl1_id has an 
> > auto_increment value in tbl1, mysql is actually generating the values for 
> > it automatically. 
> > 
> 
> Ah, I see your point. I'm guessing by your code you're using PHP? If 
> so call mysql_insert_id() after you've inserted your record into tbl1. 
> That will give you the ID of the auto increment column - see the note in 
> the below link about bigint columns if your data type is bigint.
> 
> http://uk3.php.net/mysql_insert_id
> 
> Hope this helps,
> Andy

 

Yes I'm using PHP. Can it be something like

function newPost_tbl1($id, $entry, $text)

{

$conn;

$result= mysql_query("INSERT INTO tbl1 (tbl1_id, entrytitle, entrytext)

                                             VALUES ('$id','$entry', $text)', 
$conn);

                                            $tbl1_id = mysql_insert_id($conn);

}

 

Is the above code the best way to go about it?

Thanks in advance.

_________________________________________________________________
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.

http://www.microsoft.com/windows/windowslive/products/photos.aspx

Reply via email to