The variable $HotelID is the hotelId of the record that I just inserted into
database and I want to retrive the Id of that record to insert into another
table.
what is the correct syntax of using mysql_insert_id in this case?
Jack
[EMAIL PROTECTED]
"There is nothing more rewarding than reaching the goal you set for
yourself"
----- Original Message -----
From: Samantha Savvakis <[EMAIL PROTECTED]>
To: Jacky@lilst <[EMAIL PROTECTED]>
Cc: PHP General <[EMAIL PROTECTED]>
Sent: Tuesday, January 23, 2001 10:20 PM
Subject: RE: [PHP] what is wrong about this sniplet?


> HI Jack,
>
> What is the variable $HotelID ?
>
> mysql_insert_id - has an optional parameter: link_identifier (the database
> handle)
>
> So in this case, is $HotelID your database handle? If not, then just call
> mysql_insert_id() without any parameters.
>
> Otherwise, it is always best to pass around the database handle so that
you
> know which connection you are using.
>
> Sam
>
>
> > -----Original Message-----
> > From: Jacky@lilst [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, 25 January 2001 03:17
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] what is wrong about this sniplet?
> >
> >
> > I have the sniplet to run teh query at the page to insert data as
> > shown below. After it is run, there was en error said something like
> > "Mysql warning, 0 ( zero) is not Mysql index"  and the error
> > point to the line using mysql_insert_id($HotelID);
> > My limited experience cannot tell me what should I be doing in
> > order to get what I need. Any thought?
> > ******************************************************
> > file://insert Hotel detail
> >     $insertHotel     = "INSERT INTO Hoteldetail
> > (HotelName,HotelLocation, HotelCountry,HotelPostcode,
> > HotelTelephone,Hotelfax,HotelURL,
> > HotelContactFirstName,HotelContactLastName, HotelRoomProvided,
> > HotelEmail) VALUES ('$HotelName', '$HotelLocation',
> > '$HotelCountry', '$HotelPostcode', '$Hoteltelephone',
> > '$Hotelfax', '$HotelURL', '$HotelContactFirstName',
> > '$HotelContactLastName', '$HotelRoomProvided', '$HotelEmail')";
> >         $resultHotel     = mysql_query($insertHotel);
> >         // retrive latest HotelID
> >   $latestHotelID = mysql_insert_id($HotelID);
> > ******************************************************
> > cheers
> > Jack
> > [EMAIL PROTECTED]
> > "There is nothing more rewarding than reaching the goal you set
> > for yourself"
> >
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to