| | |
Filtering categories
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2009
Posts: 3
Reputation:
Solved Threads: 0
How can we filter categories (checkbox) like this: http://tp.jobscentral.com.sg/pubsearchjobs.php
0
#2 23 Days Ago
Have you checked the view-source?
They use the same name for all checkboxes and apply a numerical value to each based on the 'id' of the category in the DB.
So the $_POST['categories'] variable will contain an array of values. You then need to either loop through this array OR create a comma separated list from this array to use in your SQL statement (hint - you'll need to use the IN keyword in the WHERE clause).
They use the same name for all checkboxes and apply a numerical value to each based on the 'id' of the category in the DB.
So the $_POST['categories'] variable will contain an array of values. You then need to either loop through this array OR create a comma separated list from this array to use in your SQL statement (hint - you'll need to use the IN keyword in the WHERE clause).
"...the woods would be a very silent place if no birds sang except for the best"
All opinions count.
F'enw i yw Mr. Blaidd. Byddwch yn ofalus - dwi'n cnoi.
All opinions count.
F'enw i yw Mr. Blaidd. Byddwch yn ofalus - dwi'n cnoi.
0
#4 17 Days Ago
Where is the problem? With the post variable or with your database field?
Your DB should have a structure something like:
user
id (PK)
username
...etc...
jobs
id (PK)
job_title
user_jobs
id (PK)
user_id (Foreign Key on user.id)
job_id (Foreign Key on jobs.id)
(This last table could be v.big, but that's OK, e.g. 30 jobs for each user. Even if you've got 10,000 users, that's still only 300,000 records - nothing for mysql)
Your DB should have a structure something like:
user
id (PK)
username
...etc...
jobs
id (PK)
job_title
user_jobs
id (PK)
user_id (Foreign Key on user.id)
job_id (Foreign Key on jobs.id)
(This last table could be v.big, but that's OK, e.g. 30 jobs for each user. Even if you've got 10,000 users, that's still only 300,000 records - nothing for mysql)
"...the woods would be a very silent place if no birds sang except for the best"
All opinions count.
F'enw i yw Mr. Blaidd. Byddwch yn ofalus - dwi'n cnoi.
All opinions count.
F'enw i yw Mr. Blaidd. Byddwch yn ofalus - dwi'n cnoi.
![]() |
Similar Threads
- Filtering Categories (PHP)
- phpBB Sub-Categories? (Growing an Online Community)
- Quicken Categories Lost (Mac Software)
- Filtering data from access database (Visual Basic 4 / 5 / 6)
- Filtering data from an access database (Visual Basic 4 / 5 / 6)
- displaying products in categories (PHP)
- Suggestion: A way to filter searches... (DaniWeb Community Feedback)
- Wants corporate images (Graphics and Multimedia)
- Office XP/2002 Access not filtering (MS Access and FileMaker Pro)
Other Threads in the PHP Forum
- Previous Thread: Global Class Variables.
- Next Thread: Dropdown menu with multiple values
| Thread Tools | Search this Thread |
apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert ip javascript joomla limit link list login mail mediawiki menu mlm msqli_multi_query multiple mycodeisbad mysql number oop parameter paypal pdf php phpincludeissue phpmyadmin problem query radio random recourse recursion regex remote script search seo server sessions sms source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web webdesign white wordpress xml youtube





