Brian Bratcher wrote:

> I am trying to setup a cutom perl script to access Mysql databases
> through HTTP.
> So far I can connect and show all information.
> this is the code I used to showall
> 
> $sth=$dbh=DBI->connect("DBI:mysql:pizza","root","");
> $sth->prepare("select * from Customer");
> $sth->execute;
> while(($phone,$name,$address,$citystatezip)=$sth->fetchrow())
> {print"$phone $name<br>";}
> $sth->finish;
> 
> 
> Now I need two more code snips to complete the tasks of the script
> 
> 1) search the database for a specifc phone number and display it.
> 
> I tried this code with no results:
> $phonenumber="357-8236";
> I know that this is in the database.


perldoc DBI

specifically, read the sections on using wildcards.  wildcards are 
better to use because they take care of escaping and such automatically. 
  you query should look something like this:

$sth->prepare("select * from Customer where phone=?");
$sth->execute($phonenumber);


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to