Re: trouble with MySQL 'LIKE' command
| From: | PHPWIN | Date: | Sat, 05 May 2001 04:53:16 +0000 |
| Subject: | Re: trouble with MySQL 'LIKE' command | ||
| References: | 1 2 3 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-7308@lists.php.net to get a copy of this message | ||
, could be html coding problem
or your data contains incomplete html like <table><tr><td>...but no closing
tags,
try
function genData($ID){
$sql=" select * from table where ID like '%".$ID."%' ";
$sql_result=mysql_result($sql) or die($sql');
$r ="<table>";
whille($result=mysql_fetch_array($sql_result)){
$r.=" <tr> ";
for($ii=0;$ii<count($result);$ii++){
$r.= " <td> ".htmlSpecialChars(stripslashes($result[$ii]))." </td>
";
}
$r.="</tr> ";
}
$r.="</table>";
return $r;
}
echo genData($ID);
----- Original Message -----
From: "r.gelstharp" <r.gelstharp@ntlworld.com>
To: <php-windows@lists.php.net>
Sent: Saturday, May 05, 2001 2:28 AM
Subject: Re: [PHP-WIN] trouble with MySQL 'LIKE' command
> Done like you recommended with the select....like '%".$var."%' but it
still
> gives me empty rows of data.
>
> Everytime I try and search for something it returns with 7 rows of data,
all
> of which are blank. I'm using the basic mysql_num_rows to get the number
of
> rows of data it retrieves, and I'm using a WHILE($data =
> mysql_fetch_array($sql_result)) to output the rows of data.
>
> If it's not the SQL statement, what could be doing this? I ask in case
> you've heard this problem mentioned by some thick newbie like meself
before.
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
> For additional commands, e-mail: php-windows-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>