Lost Password?

Go Back   CodeCall Programming Forum > Web Development Forum > PHP Forum

PHP Forum Use this forum to discuss all aspects of PHP Development. PHP is a server-side, cross-platform, HTML embedded scripting language that lets you create dynamic web pages.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-11-2008, 11:12 AM
phpforfun's Avatar   
phpforfun phpforfun is offline
Programming God
 
Join Date: Feb 2008
Posts: 742
Last Blog:
Programming "Just a ...
Rep Power: 8
phpforfun will become famous soon enoughphpforfun will become famous soon enough
Default Advanced PHP search function

Hey guys, so im working on my website, and so far, its the hardest one ive done... I have done many search functions, but mostly just key words or something like that.

take a look at this page..

Analyze That Host

I wanted to make it so if you select "picky" on the development or management form, it will not search the SQL database for webmasters who have any of those settings, but if you select picky, thats where I get kinda stuck.

Here is my code so far.
PHP Code:
    if(isset($subaction)) { 

        if(
$subaction === "submit"){

            if(empty(
$development)){
                
$development "no";
            }
            if(
$development === "yes"){
                if(isset(
$PHP)){    
                    
//do this
                
}
                if(isset(
$ASP)){    
                    
//do this
                
}
                if(isset(
$flash)){    
                    
//do this
                
}
                if(isset(
$java)){    
                    
//do this
                
}
            } Else {
                
//code for disabled development
            
}
        }

    } Else {

        Echo 
'<div align="center"><b>Search Request Not Yet Sent</b></div>';

    } 
In place of each //do this statement, do I need to add a ton of sql code to limit that? is there a way I can just make the sql query line have like 30 where statements, so it keeps limiting down the search output? Thanks guys.

Last edited by phpforfun; 04-11-2008 at 11:16 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 04-11-2008, 02:56 PM
Xav's Avatar   
Xav Xav is offline
Code Warrior
 
Join Date: Mar 2008
Location: London, England
Posts: 5,263
Last Blog:
Web slideshow in JavaS...
Rep Power: 45
Xav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to behold
Send a message via MSN to Xav
Default Re: Advanced PHP search function

How many times are you going to flash that site around, dude? It's practically my HOMEPAGE!

Sorry, don't know much PHP.
__________________
[TRUTH] TcM is the best moderator ever! [/TRUTH]
"Valid XHTML is like sex - everybody claims to have the same goal, but everybody has their own tricks and results vary wildly."
Mr. Xav | Website | Forums | Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-11-2008, 02:59 PM
phpforfun's Avatar   
phpforfun phpforfun is offline
Programming God
 
Join Date: Feb 2008
Posts: 742
Last Blog:
Programming "Just a ...
Rep Power: 8
phpforfun will become famous soon enoughphpforfun will become famous soon enough
Default Re: Advanced PHP search function

Quote:
Originally Posted by Xav View Post
How many times are you going to flash that site around, dude? It's practically my HOMEPAGE!

Sorry, don't know much PHP.
im not trying to flash it around, I just need some help. The other thread was more for ideas. If I was flashing it around, id make a thread saying the status of it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-12-2008, 08:37 AM
Xav's Avatar   
Xav Xav is offline
Code Warrior
 
Join Date: Mar 2008
Location: London, England
Posts: 5,263
Last Blog:
Web slideshow in JavaS...
Rep Power: 45
Xav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to beholdXav is a splendid one to behold
Send a message via MSN to Xav
Default Re: Advanced PHP search function

Ok. You're forgiven.
__________________
[TRUTH] TcM is the best moderator ever! [/TRUTH]
"Valid XHTML is like sex - everybody claims to have the same goal, but everybody has their own tricks and results vary wildly."
Mr. Xav | Website | Forums | Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-12-2008, 12:14 PM
phpforfun's Avatar   
phpforfun phpforfun is offline
Programming God
 
Join Date: Feb 2008
Posts: 742
Last Blog:
Programming "Just a ...
Rep Power: 8
phpforfun will become famous soon enoughphpforfun will become famous soon enough
Default Re: Advanced PHP search function

has anyone done this kind of search before?

I just need help modifying the query with each variable like if $notpicky is checked, how do I make it not add the 10 variables to the query?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 04-12-2008, 06:22 PM
John's Avatar   
John John is online now
Co-Administrator
 
Join Date: Jul 2006
Age: 19
Posts: 2,731
Last Blog:
Passwords
Rep Power: 20
John has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud of
Send a message via AIM to John
Default Re: Advanced PHP search function

I really don't understand the whole idea behind "Picky" and "Not Picky" which is why I have not responded.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-12-2008, 06:31 PM
phpforfun's Avatar   
phpforfun phpforfun is offline
Programming God
 
Join Date: Feb 2008
Posts: 742
Last Blog:
Programming "Just a ...
Rep Power: 8
phpforfun will become famous soon enoughphpforfun will become famous soon enough
Default Re: Advanced PHP search function

picky means there picky about management / development, not picky means I want the code to not even look at the development or management sections in the sql db...


lets say they select "picky", I want the sql query to select WHERE PHP='yes'... if they select not picky, I dont want it to add any of the management or development variables or anything in the sql query.

basicly, without having 1000 sql query commands, how do I use eac line to add an sql query...
PHP Code:
  if(isset($subaction)) { 

        if(
$subaction === "submit"){

            if(empty(
$development)){
                
$development "no";
            }
            if(
$development === "yes"){
                if(isset(
$PHP)){    
                   
//code to add "WHERE PHP='yes'" to the sql query
                
}
                if(isset(
$ASP)){    
                   
//code to add "WHERE ASP='yes'" to the sql query
                
}
                if(isset(
$flash)){    
                    
//code to add "WHERE flash='yes'" to the sql query
                
}
                if(isset(
$java)){    
                    
//code to add "WHERE java='yes'" to the sql query
                
}
            } Else {
                
//not add any of the php, java, sql, flash etc to the query.
            
}
        }

    } Else {

        Echo 
'<div align="center"><b>Search Request Not Yet Sent</b></div>';

    } 

Last edited by phpforfun; 04-12-2008 at 06:36 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-12-2008, 06:52 PM
John's Avatar   
John John is online now
Co-Administrator
 
Join Date: Jul 2006
Age: 19
Posts: 2,731
Last Blog:
Passwords
Rep Power: 20
John has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud of
Send a message via AIM to John
Default Re: Advanced PHP search function

Unless I am still not understanding, you can do something like this:
PHP Code:
$sql "SELECT * FROM `table` WHERE `something`='idk'";
                if(isset(
$PHP)){    
                   
$sql .= " AND `PHP`='yes'";
                }
                if(isset(
$ASP)){    
                   
$sql .= " AND `ASP`='yes'";
                }
                if(isset(
$flash)){    
                    
//code to add "WHERE flash='yes'" to the sql query
                
}
                if(isset(
$java)){    
                    
//code to add "WHERE java='yes'" to the sql query
                


$result mysql_query($sql); 
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall

Last edited by John; 04-12-2008 at 06:55 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 04-12-2008, 07:30 PM
phpforfun's Avatar   
phpforfun phpforfun is offline
Programming God
 
Join Date: Feb 2008
Posts: 742
Last Blog:
Programming "Just a ...
Rep Power: 8
phpforfun will become famous soon enoughphpforfun will become famous soon enough
Default Re: Advanced PHP search function

Quote:
Originally Posted by John View Post
Unless I am still not understanding, you can do something like this:
PHP Code:
$sql "SELECT * FROM `table` WHERE `something`='idk'";
                if(isset(
$PHP)){    
                   
$sql .= " AND `PHP`='yes'";
                }
                if(isset(
$ASP)){    
                   
$sql .= " AND `ASP`='yes'";
                }
                if(isset(
$flash)){    
                    
//code to add "WHERE flash='yes'" to the sql query
                
}
                if(isset(
$java)){    
                    
//code to add "WHERE java='yes'" to the sql query
                


$result mysql_query($sql); 
Ill try that, thanks john
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 04-12-2008, 08:26 PM
phpforfun's Avatar   
phpforfun phpforfun is offline
Programming God
 
Join Date: Feb 2008
Posts: 742
Last Blog:
Programming "Just a ...
Rep Power: 8
phpforfun will become famous soon enoughphpforfun will become famous soon enough
Default Re: Advanced PHP search function

That works great! Thanks!..

how do I do less than or greater than statements in SQL? WHERE lowestprice<'2' ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP 5 and OOP Jordan PHP Tutorials 10 08-22-2008 05:37 AM
Google Hacking John Tutorials 6 07-22-2008 09:37 AM
Debugging with PHP Jordan PHP Tutorials 1 01-30-2008 07:39 PM


All times are GMT -5. The time now is 11:39 PM.

Contest Stats

John ........ 223.00000
dargueta ........ 168.00000
Xav ........ 164.00000