PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I did use the word "Ford" only following your example... the query is going to find any record where the "keyword" field value is present in your $row->title string
regarding your error... echo your query again to see if it is correct or not... and also I suggest you to change the usage of $row here
Could you do something like this:
select everything from the relate db.
Echo the keyword.
Is $keyword similar to $title - if YES, show something.
And do this for all keywords.
So rather than querying the keywords in the SQL statement itself, extract all keywords, and then only show if they match.
But how would you do that in PHP - finding if a word is in a statement? ie. is keyword 'ford' in statement 'ford 150 truck'?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
relate WHERE INSTR(ford 150, keyword) > 0
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in C:\xampp\phpMyAdmin\site\includes\product.inc on line 438
Warning: mysql_free_result() expects parameter 1 to be resource, boolean given in C:\xampp\phpMyAdmin\site\includes\product.inc on line 441
This is the error I get, after echoing the query.
The $row etc are all set correctly.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
relate WHERE INSTR(ford 150, keyword) > 0
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in C:\xampp\phpMyAdmin\site\includes\product.inc on line 438
Warning: mysql_free_result() expects parameter 1 to be resource, boolean given in C:\xampp\phpMyAdmin\site\includes\product.inc on line 441
This is the error I get, after echoing the query.
The $row etc are all set correctly.
and I did answer and show you which was the error.... let point it out again
WHERE INSTR(ford 150, keyword) > 0
you don't see that ford 150 there doesn't have single quotes surrounding it? ... for that reason your query is INVALID... hence the errors that you get after that. what you must do is to be sure that the STRING that you are using is enclosed in single quotes... simple as that
Ok, well your initial code did not have quotes around it either.
However, I have put them in and BINGO! I've tried it on various products where there are keywords and arnt - and works perfect.
So thank you for your hard work in helping me.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.