Hi Everybody,
this is actually more of a mysql question but i'm working with both that and php.
My name is Henry, what I'm trying to do is do a query inside php
$findPagesWithKeywords = "SELECT * FROM keyTable WHERE
keyword = $tok";
$result = mysql_query($findPagesWithKeywords, $conn)
or die ("could not query"
$conn is the connection I established,
$str is a variable that is like "earth fire wind"
and I used strtok to parsed it and in a while loop have
each of those words, "earth", "fire", and "wind" stored in a variable called $tok.
my program depend on being able to search for each of these words from the string one at a time, but I have now learned that SELECT usually works with a set string in double quotes like "i_am_a_string".
I also tried doing it with the LIKE under WHERE...
$findPagesWithKeywords = "SELECT * FROM keyTable WHERE
keyword LIKE $tok";
$result = mysql_query($findPagesWithKeywords, $conn)
or die ("could not query"
it doeosn't seem to do the magic either, keeps "dying".
is there anyway that I can get around this?
Any suggestion would be greatly appreciated.
Henry
p.s. I posted a similar message in the mysql forum, Just trying to get help as soon as I can. no offense to anyone
this is actually more of a mysql question but i'm working with both that and php.
My name is Henry, what I'm trying to do is do a query inside php
$findPagesWithKeywords = "SELECT * FROM keyTable WHERE
keyword = $tok";
$result = mysql_query($findPagesWithKeywords, $conn)
or die ("could not query"
$conn is the connection I established,
$str is a variable that is like "earth fire wind"
and I used strtok to parsed it and in a while loop have
each of those words, "earth", "fire", and "wind" stored in a variable called $tok.
my program depend on being able to search for each of these words from the string one at a time, but I have now learned that SELECT usually works with a set string in double quotes like "i_am_a_string".
I also tried doing it with the LIKE under WHERE...
$findPagesWithKeywords = "SELECT * FROM keyTable WHERE
keyword LIKE $tok";
$result = mysql_query($findPagesWithKeywords, $conn)
or die ("could not query"
it doeosn't seem to do the magic either, keeps "dying".
is there anyway that I can get around this?
Any suggestion would be greatly appreciated.
Henry
p.s. I posted a similar message in the mysql forum, Just trying to get help as soon as I can. no offense to anyone