Re: simple php search

From: Date: Fri, 05 Dec 2003 15:00:09 +0000
Subject: Re: simple php search
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-171995@lists.php.net to get a copy of this message
"Sophie Mattoug" <sophie@sitadelle.com> wrote in message news:3FD09C24.7070101@sitadelle.com... > Paul Duggan wrote: > > >if I create a text box: > > > ><body> > > > ><form action="nextpage.html" method="GET" > >name="myform"> > > > > <input type="Text" name="surname" align="TOP" > > size="25"><br> > > > > <input type="Submit" value="Submit" align="MIDDLE"> > > > ></form> > > > > > >how do I go about extracting a surname from a mysql database? > > > > > > > >will it be something along the lines? > > > >select firstname,surname > >from employees > >where surname = textbox.surname; > > > > > > "SELECT firstname, surname FROM employees WHERE surname = > '{$_GET['surname']}'" You might also want to do it this way... "SELECT firstname, surname FROM employees WHERE surname = \"{$_GET['surname']}\"" Just in case their name is something like O'Neil, it won't interfere with your script. Good luck, Dimitri Marshall > > > > >new to this so im trying to get my head around it, basically i just want to > >search a mysql database by someones surname. > > > >cheers! > > > > > > > >

« previous php.general (#171995) next »