kvigor wrote:
Ok Jim,
This is what I have so far and I'm still working it out.
$in_list = "".join('',$someArrayList); // do I really need to concatenate
it needs to be
$in_list = "'".join("','",$someArrayList)."'"; // you need the quotes!!
or separate anything here since my array values will be '7orange50lbs'? //
this is the format I want.
You are going wrong right here. First off you took out all the quoting
Your search items must be quoted and separated by commas. Remember, we want it to check a
list/array() of items
$in_list must look like this when done 'item1','item2','item3'....
in SQL, this is a list.
$query_One = "SELECT * FROM shoe WHERE CONCAT(size,color,weight)
IN({$in_list})"; // size, color, weight are my column names
if you echo $query_One , what do you get?
$result = mysql_query($query_One ,$connection) or die("Query failed: ".
mysql_error($connection));
before you run the fetch, you need to double check that you got something back, otherwise you will
get an error from php.
if ( mysql_num_rows($results) > 0 ) {
while ( $row = mysql_fetch_array(
} else {
echo "No results";
}
$row = mysql_fetch_array($result);
and I would recommend that you use either *_assoc() or *_row() instead of *_array().
Doesn't use as much memory, and your resulting $row variable doesn't have two of what you are
looking for.
This is the error I get back from the query:
Query failed: Unknown column '6blue40lbs' in 'where clause'
This is because you took out the quotes from above. Put them back and it might just work.
SQL will see the un-quoted 6blue40lbs and think that it is a string.
If it was quoted, it would not.
// where am I
going wrong?
--
Jim Lucas
"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."
Twelfth Night, Act II, Scene V
by William Shakespeare
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php