Search the Community
Showing results for tags 'and'.
-
I am trying to build search option in which I want to match multiple options with database values 1)When using the "where IN" clause the values compared are 'OR'd' and i need it 'AND' the array. 2) $do=mysql_query("SELECT * from hire WHERE sname=$sname AND lhname IN ($ser2) AND exnum IN ($ser3)"); while($row2=mysql_fetch_array($do)) { ?> <tr> <td><?php echo $row2['id']; ?></td> <td><?php echo $row2['fname']; ?></td> <td><?php echo $row2['lname']; ?></td> <td><?php echo $row2['lhname']; ?></td> <td><?php echo $row2['cnum']; ?></td> <td><?php echo $row2['exnum']; ?></td> <td><?php $id=$row2['id']; $row3=mysql_query("SELECT * from skill where id=$id"); while($val=mysql_fetch_array($row3)) { $bits=$val['sname']; $arr[]=$bits; } $imp=implode(",",$arr); echo $imp ; ?></td> </tr> The above code gives Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given at the while loop please help Thank you!
- 4 replies
-
- mysql
- fetch_array
-
(and 2 more)
Tagged with:
-
I am creating a search page with php and codeigniter. I created the query which is; "SELECT * FROM my_account WHERE inex='$inex' AND type='$type' AND date BETWEEN '$date1' AND '$date2' " $date1 and $date2 values comes from form input and I have no problem here. On the other hand $inex value is also coming from form dropdown. $options = array( 'Income' =>'Income', 'Expense' =>'Expense', ); echo "<td>" . form_dropdown('inex',$options) ."</td>"; Now, if i do a search between two dates, i have to use Income or Expense values. But, I need the third option in the options array so that i can also choose both so that i can see both income and expenses between these two dates. I think there is a simple answer for that but somehow i cant figure it out. helps are appreciated. thanks in advance.