Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 9th, 2007, 05:05 AM
Registered User
Join Date: Oct 2007
Location: Birgunj, , Nepal.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Urgently Need Help

Dear All,

i want to make advance search engine in PHP.i have 7 fields and all fields are option.if user select only 4 filed,then search engine will display the result according to 4 selected field.?

how to do it ? if anybody have any idea or document or book or article please share with me? its very urgent.

thanks to all in advance

Reply With Quote
  #2 (permalink)  
Old October 10th, 2007, 12:54 AM
Authorized User
Join Date: Mar 2005
Location: none, none, Philippines.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to cyber_kaley20 Send a message via AIM to cyber_kaley20 Send a message via Yahoo to cyber_kaley20

check box
search mytextbox >>>>

im going to select a 7 fields

$sql = "SELECT * FROM articles WHERE

if (data1 = "checkbox") //////find the data with selected
          $sql .= "data1 LIKE '$mysearchtext'";/////// if the data1

                                                //////it selected
if ($data2 = "checkbox")
    $sql .= "data2 LIKE '$mysearchtext'";
if($data3 ="checkbox")
        $sql .= "data3 LIKE '$mysearchtext'";
if($data4 = "checkbox")
     $sql .= "data4 LIKE '$mysearchtext'";

if($data5 = "checkbox")
     $sql .= "data5 LIKE '$mysearchtext'";

if($data6 = "checkbox")
     $sql .= "data6 LIKE '$mysearchtext'";

if($data7 = "checkbox")
    $sql .= "data7 LIKE '$mysearchtext'";

$query = mysql_query($sql) or die(mysql_error());
$row_sql = mysql_fetch_assoc($query);
$total = mysql_num_rows($query);

# if($total>0) {
# while ($row_sql = mysql_fetch_assoc($query)) {//echo out the results
# echo ''.$row_sql['title'].'<br />'.$row_sql['subtitle'].'';
# }
# } else
# {
# echo "No results to display";
# }

Reply With Quote
  #3 (permalink)  
Old October 16th, 2007, 02:39 PM
Registered User
Join Date: Aug 2007
Location: San Rafeael, Heredia, Costa Rica.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts

Maybe you can use this Example

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
    $Sql= "Select * FROM MyTable WHERE ";
    if (isset($textfield1))
        $Sql.="MyTable.field1 = $textfield1 AND ";

    if (isset($textfield2))
        $Sql.="MyTable.field2 = $textfield2 AND ";

    if (isset($textfield3))
        $Sql.="MyTable.field3 = $textfield3 AND ";

    if (isset($textfield4))
        $Sql.="MyTable.field4 = $textfield4 AND ";

    if (isset($textfield5))
        $Sql.="MyTable.field5 = $textfield5 AND ";

    if (isset($textfield6))
        $Sql.="MyTable.field6 = $textfield6 AND ";

    if (isset($textfield7))
        $Sql.="MyTable.field7 = $textfield7 AND ";

        //You can change the WHERE part as you wish, in order to do what you want

    //$Rs = mysql_query($Sql);
    .Do everything you need with the RecordSet Rs
    echo $Sql;
<p>Seach Filter:</p>
<FORM ENCTYPE="multipart/form-data" id="form1" name="form1" method="post" action="Prueba.php">
    <table border="1" width="100%">
                <input type="text" name="textfield1" />
                <input type="text" name="textfield2" />
                <input type="text" name="textfield3" />
                <input type="text" name="textfield4" />
    <table border="1" width="100%">
                <input type="text" name="textfield5" />
                <input type="text" name="textfield6" />
                <input type="text" name="textfield7" />
    <input name="Agregar" type="submit" />


Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
JMeter: Need help Urgently motionless BOOK: Expert One-on-One J2EE Design and Development 0 February 19th, 2008 12:16 PM
Need Help Urgently dpkbahuguna Beginning VB 6 2 August 10th, 2006 01:29 AM
urgently need help sumeghagupta .NET Web Services 1 October 5th, 2004 11:38 PM
Urgently need help... scott Access 23 October 18th, 2003 09:40 PM

All times are GMT -4. The time now is 02:31 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.