this has got me stumped, i have a simple few text boxes that users type in the hotel name.
Some names have special char in them like: L 'Ermitage
I have two tables, the Top3 table has data that i display to users
The details are where the main data is kept. My problem is that if i search the DB for this L 'Ermitage for example, it does not find it and returns previous value assigned to $sid
<?php
//CONNECT TO MYSQL
include_once "connect_to_mysql.php";
//EXTRACT DATA FROM MY TOP HOTELS
$extract = mysql_query("select * from tbl_tophotels order by fld_rank asc limit 3");
while ($row = mysql_fetch_assoc($extract))
{
//ASSIGN DATA
$id = $row['id'];
$hotelname = $row['fld_hotelname'];
$hotelimage = $row['fld_image'];
$rank = $row['fld_rank'];
//DISPLAY IN BOX THE TOP 3
echo "<table width=230 cellspacing=0 cellpadding=0>";
echo " <tr>";
echo " <td width=110 rowspan=2 valign=top><img src=hotels/$hotelimage width=100 height=75></td>";
echo " <td width=100 valign=top>$hotelname</td>";
//FOR THE HYPERLINK LOOK FOR THE ID BY SEARCHING THE DESTINATIONS TABLE, USE THE ID IN HYPERLINK
//WHEN USER CLICKS HYEPRLINK THE DETAILS SHOULD SHOW UP, DETAILS PULL FRONM THE DESTINATION TABLE
$extract2 = mysql_query("SELECT * FROM tbl_destination WHERE fld_hotelname='$hotelname'");
while ($rows = mysql_fetch_assoc($extract2))
{
$sid = $rows['id'];
}
//DISPALY HYPERLINK WITH ID
echo " <td width=20 valign=top><div align=right><a href=details.php?id=$sid><img src=images/aro.png width=14 height=20 border=0></a></div></td>";
//CARRY ON WITH TABLE
echo " </tr>";
echo " <tr>";
echo " <td colspan=2> </td>";
echo " </tr>";
echo "</table>";
echo "<br>";
}
?>
I tried the mysql_real_escape_string($hotelname) in my search it does not work, how do i search for a name like that to have it return the record i need
thnx