Re: Selecting Rows Based on Row Values Being in Array

From: Date: Wed, 04 Jul 2007 05:21:33 +0000
Subject: Re: Selecting Rows Based on Row Values Being in Array
References: 1 2 3 4 5 6 7 8 9  Groups: php.general 
Request: Send a blank email to php-general+get-258220@lists.php.net to get a copy of this message
kvigor wrote:
Jim, Thanks for all you help. Tell me where to mail you the check "seriously". If we get this right I'll owe you. OK, the query string now looks like you said it would. However Query isn't returning a match. //DETAILS========================================================= My $list array looks like this one echo'd: $list[0] =7orange50lbs $list[1] =8purple60lbs where is the part that it join()'s things together?
what is the output of the join() call
Now when I do this: $query_One= "SELECT * FROM shoe WHERE CONCAT(size,color,weight) IN({$in_list})";
echo $query_One; and show me the results of the echo also, run this SQL statement in phpmyadmin and see what it returns
$result = mysql_query($query_One,$connection) or die("Query failed: ". mysql_error($connection));
get rid of this, basically you are throwing away your first row of results.
$row = mysql_fetch_assoc($result); while($row = mysql_fetch_assoc($result)) {extract($row); echo "<table width='2400' cellpadding='5' cellspacing='5' class='tborder'><tr>
      <td width='46' border = '1' bordercolor ='#3E5C92' height='20' align='left' class='tcat'>$count</td>
      <td width='200' align='left' class='row2'>$size</td>
      <td width='200' align='left' class='row2'>$color</td>
      <td width='200' align='left' class='row2'>$weight</td>
      </tr>
      </table>";
} No rows are returned to the screen. I know I should at least have 2 rows return because my TABLE has 2 rows in it and both rows are in $in_list[0] and[1].
                          size  color       weight
Row1 looks like: 7     orange     50lbs    //This is from phpMyAdmin table export
Row2 looks like: 8     purple     60lbs    //This is from phpMyAdmin table export
I get no MySQL errors either. So I'm wondering why aren't rows returning? //END DETAILS==============================================================
-- 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

« previous php.general (#258220) next »