RE: [PHP] what is wrong about this sniplet?
| From: | Samantha Savvakis | Date: | Wed, 24 Jan 2001 04:20:03 +0000 |
| Subject: | RE: [PHP] what is wrong about this sniplet? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-36324@lists.php.net to get a copy of this message | ||
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:jacky@activelifestyle.com]
> Sent: Thursday, 25 January 2001 03:17
> To: php-general@lists.php.net
> 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?
> ******************************************************
> //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
> jacky@activelifestyle.com
> "There is nothing more rewarding than reaching the goal you set
> for yourself"
>