Im creating a search page.
I need to search few data bases within one page so I used a como box to change tables, I dont know about PHP sooo this might be wrong.
If some one know a better way pls help me thanx.
Here is The Form :
<form id="form1" name="form1" method="post" action="">
<label>Search :
<input type="text" name="q" id="q" />
</label>
<label>
<input type="submit" name="btn" id="btn" value="Search" />
</label>
<label>
<select name="lst" id="lst">
<option value="<?php $table = 'book_new_item';?>">Books</option>
<option value="<?php $table = 'comp_new_item'; ?>">Computers</option>
<option value="<?php $table = 'mob_new_item' ;?>">CellPhones</option>
<option value="<?php $table = 'clothe_new_item'; ?>">Clothing</option>
<option value="<?php $table = 'camera_new_item'; ?>">Cameras</option>
<option value="<?php $table = 'dvd_new_item' ;?>">DVDs</option>
<option value="<?php $table = 'sport_new_item'; ?>">Sporting</option>
<option value="<?php $table = 'toy_new_item' ;?>">Toys</option>
<option value="<?php $table = 'music_new_item' ;?>">Musical</option>
<option value="<?php $table = 'other_new_item' ;?>">Others</option>
</select>
</label>
</form>
Here is the SQL : ( Both in the same page)
mysql_select_db($database_localhost, $localhost);
$query_search = sprintf("SELECT topic, detail, name, `datetime`, reply FROM $table WHERE topic LIKE %s", GetSQLValueString("%" . $colname_search . "%", "text"));
$query_limit_search = sprintf("%s LIMIT %d, %d", $query_search, $startRow_search, $maxRows_search);
$search = mysql_query($query_limit_search, $localhost) or die(mysql_error());
$row_search = mysql_fetch_assoc($search);
I need to search few data bases within one page so I used a como box to change tables, I dont know about PHP sooo this might be wrong.
If some one know a better way pls help me thanx.
Here is The Form :
<form id="form1" name="form1" method="post" action="">
<label>Search :
<input type="text" name="q" id="q" />
</label>
<label>
<input type="submit" name="btn" id="btn" value="Search" />
</label>
<label>
<select name="lst" id="lst">
<option value="<?php $table = 'book_new_item';?>">Books</option>
<option value="<?php $table = 'comp_new_item'; ?>">Computers</option>
<option value="<?php $table = 'mob_new_item' ;?>">CellPhones</option>
<option value="<?php $table = 'clothe_new_item'; ?>">Clothing</option>
<option value="<?php $table = 'camera_new_item'; ?>">Cameras</option>
<option value="<?php $table = 'dvd_new_item' ;?>">DVDs</option>
<option value="<?php $table = 'sport_new_item'; ?>">Sporting</option>
<option value="<?php $table = 'toy_new_item' ;?>">Toys</option>
<option value="<?php $table = 'music_new_item' ;?>">Musical</option>
<option value="<?php $table = 'other_new_item' ;?>">Others</option>
</select>
</label>
</form>
Here is the SQL : ( Both in the same page)
mysql_select_db($database_localhost, $localhost);
$query_search = sprintf("SELECT topic, detail, name, `datetime`, reply FROM $table WHERE topic LIKE %s", GetSQLValueString("%" . $colname_search . "%", "text"));
$query_limit_search = sprintf("%s LIMIT %d, %d", $query_search, $startRow_search, $maxRows_search);
$search = mysql_query($query_limit_search, $localhost) or die(mysql_error());
$row_search = mysql_fetch_assoc($search);
he he ammo mama nam danne na..

