|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
using an array within a mysql query??
i'm using a select multiple html menu ....the user has a choice of selections where any number of those selections can be contained into the array "job_title_id[]" ...which then goes to the msql query below. currently the mysql query captures only the first selection hence.... $job_title_id[0]. how do i adjust the query (or i guess the $job_title_id[0] array inside the query?) to capture all the selected content?
Code:
$sql_job_title_count = ("SELECT COUNT(*) FROM p1_list_creative
WHERE p1_list_creative.country_id = '".$country_id."'
AND p1_list_creative.job_title_id = '".$job_title_id[0]."'");
$result_job_title_count = mysql_query($sql_job_title_count);
$num_job_title_count = mysql_result($result_job_title_count,0,0);
print ($num_job_title_count);
cheers! |
|
#2
|
|||
|
|||
|
Create a loop (probably a for loop) that goes through all entries in the array appending ' OR field=value' in the appropriate place in your sql.
Hope this helps, -KM- |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > using an array within a mysql query?? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|