Page 1 of 1

{Solved}:How can i search a full field in 1 table...

Posted: Fri Apr 27, 2012 6:42 am
by mekha
How can i search a full field in 1 table...?
for example...
i want to search in all categories

<option value="????????">All categories</option>?

i search every category like this and success

Code: Select all

<?php
								mysql_query("SET NAMES 'utf8'");
							$result2 = mysql_query("SELECT Id as value,category_name as title FROM categories");
							while($row = mysql_fetch_assoc($result2)){
								extract($row);					
								?>
								<option value="<?=$value?>"><?=$title?></option>
								<?php
							}
							?>
<option value="????????">All categories</option>?
now how can i search all the Id's ? in 1 option (All categories)

Re: How can i search a full field in 1 table...

Posted: Fri Apr 27, 2012 6:54 am
by Celauran
Searching all categories is the same as not specifying any category criteria in your WHERE clause.

Re: How can i search a full field in 1 table...

Posted: Fri Apr 27, 2012 6:57 am
by mekha
i didnt understand :\ ... how the query will be ?

Re: How can i search a full field in 1 table...

Posted: Fri Apr 27, 2012 7:01 am
by mekha
do you mean?

<?php
$sql4311=mysql_query("SELECT * FROM locations");
$resultall=mysql_fetch_assoc($sql4311);
?>

<option value="<?=$resultall['location_id']?>">كل المناطق</option>

Re: How can i search a full field in 1 table...

Posted: Fri Apr 27, 2012 7:37 am
by mekha
ok i solved it by myself..
i just added:
<option value=""></option>
value="empty"