Rv: Showing search results with links ... sorry forgot to post php code
am 29.10.2009 23:32:20 von Juan Stiller--0-571200420-1256855540=:96583
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Hi there i`got this php script that shows results when the user type letter=
s in a searchbox, stretching the results every time the user enters a new l=
etter. But i would like every result shown, to have a link to a specific ht=
ml page, how can i do that. I mean i am using a small guestbook example tha=
t i found there, that uses mysql php ajax to do the job of polling the resu=
lts out of the mysql database, but i have to implement this with a very lar=
ge database that shows parts wich have unique part number and i have more t=
hat 3500 parts so i don`t know how to do this can anyone point me the right=
direction?
Thanks
Juan
PS: Sorry this is the code
=
php=0Adefine(HOST, "localhost");=0Adefine(USER, "root");=0Adefine(PW, "root=
");=0Adefine(DB, "ymad");
$connect =3D mysql_connect(HOST,USER,PW)=0Ao=
r die('Could not connect to mysql server.' );
mysql_select_db(DB, $con=
nect)=0Aor die('Could not select database.');
$term =3D strip_tags(sub=
str($_POST['search_term'],0, 100));=0A$term =3D mysql_escape_string($term);=
$sql =3D "select nombre,telefono from directory where nombre like '%=
$term%' or telefono like '%$term%' order by nombre asc";
$result =3D m=
ysql_query($sql);
$string =3D '';
if (mysql_num_rows($result) > 0=
){=0A while($row =3D mysql_fetch_object($result)){=0A $string .=3D "=
".$row->nombre." - ";=0A $string .=3D $row->telefono."";=0A $=
string .=3D "
\n";=0A }
}else{=0A $string =3D "No matches!";=0A}=
echo $string;=0A?>
=0A Yahoo! Cocina
Encontra las mej=
ores recetas con Yahoo! Cocina.
=0Ahttp://ar.mujer.yahoo.com/cocina/
--0-571200420-1256855540=:96583--