Jump to content

query problem


kvnirvana

Recommended Posts

When I use this query

$sql1="select * from fagudtryk_muskler where latinsk like \"$trimmed%\" order by latinsk UNION ALL
select * from fagudtryk_knogler where latinsk like \"$trimmed%\" order by latinsk";

//-run  the query against the mysql query function
$result=mysql_query($sql1);
//-count  results
$numrows=mysql_num_rows($result);

 

I get this error

 

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given

 

How can I fix this?

Link to comment
https://forums.phpfreaks.com/topic/219397-query-problem/
Share on other sites

I think I should do it this way instead

 

$sql1="SELECT * FROM kasper.fagudtryk_muskler
LEFT OUTER JOIN kasper.fagudtryk_knogler
ON fagudtryk_muskler.latinsk or fagudtryk_knogler.latinsk like \"$trimmed%\"
";

 

I don't think I can do like this  "fagudtryk_muskler.latinsk or fagudtryk_knogler.latinsk" So how should I do it? I want it to say 'where fagudtryk_muskler.latinsk or fagudtryk_knogler.latinsk is like the word searched for'

Link to comment
https://forums.phpfreaks.com/topic/219397-query-problem/#findComment-1137667
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.