Re: Yet more strings
| From: | Johannes Janson | Date: | Wed, 21 Mar 2001 12:00:14 +0000 |
| Subject: | Re: Yet more strings | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-7677@lists.php.net to get a copy of this message | ||
Hi,
I'm not quite sure but try to play a bit with the '".$row[...]."' part.
that looks too much. leave out the "" and/or the period.
good luck
Johannes
""Mick Lloyd"" <mjl@consultingrooms.com> schrieb im Newsbeitrag
news:00c001c0b1ea$54a5f5c0$5c0083ca@oemcomputer...
> CC's suggestion of using mysql_num_rows helped to clarify the problem
rather
> than find a solution! The problem is with mysql not PHP. When I use:
>
> $resultp = mysql_query("select Primaryid from primarycodes where Code =
> '".$row[Primaryexpertise]."'") or die (mysql_error());
>
> it doesn't return a resource id#, ie the query fails. mysql_num_rows
returns
> 0.
>
> Using:
>
> $resultp = mysql_query("select Primaryid from primarycodes where Code LIKE
> '%$row[Primaryexpertise]%'") or die (mysql_error());
>
> it works, mysql_num_rows returns 1.
>
> I have also checked the string length of $row[Primaryexpertise] (the value
> of which is Biology for example) and it shows that there are no "hidden"
> characters in the field value (ie strlen returns 7).
>
> Running all this at the mysql shell (is that the word?) results in the
same
> errors.
>
> The row values are Primaryid (8) and Code (Biology).
>
> mysql>select Primaryid,Code from primarycodes where Code like '%Biology%';
> \\returns the correct values
>
> mysql>select Primaryid,Code from primarycodes where Primaryid = 8;
\\returns
> the correct values
>
> mysql>select Primaryid,Code from primarycodes where Code = 'Biology';
> \\returns Empty set
>
> I'm no expert (obviously) but something seems odd here.
> Regards
>
> Mick Lloyd
> mjl@consultingrooms.com
> Tel: +44 (0)1684 560224
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>