Jump to content

How to combine a mysql query and an array?


otixz

Recommended Posts

Hi,

 

I really need help

 

I have an array, and a mysql_query...

 

here is the code:

 

$colorList = array($BSAccountancy,$MgntAccounting,$BussMgt,$CompMgt,$Mktg,$OfficeMgt,$CompEduc,$AssComsec,$Mechanical,$Electrical,$Industrial,$Civil,$ECE,$COE,$BioMed,$ElectricalTech,$MechanicalTech,$BSHRM,$AssociateHRM,$BSND,$BSPhsychology,$ABPhsychology,$ABPolSci,$ABMasscom,$ABJournalism,$ABLegalMgt,$BSElemEduc,$BSSecEduc,$CompSci,$ACT,$BSIT,$BSIM,$MaritimeTranspo,$MarineEng,$BasicSeaman,$COLLEGEOFLAW,$EARNINGUNITS,$MEDTRANS,$NURSING,$GRADESCHOOL,$HIGHSCHOOL,$Medicine,$DenstistryProper,$PreDentistry,$DentalHygiene,$DentalTechnology,$PhysicalTherapy,$CPT,$OccupationalTherapy,$Pharmacy,$RadiologicTechnology,$Midwifery);


				//print_r ($colorList);
				//select all courses
				$qry_course = mysql_query("select * from tblcourses where title IS NULL");
				$row_course = mysql_num_rows($qry_course);




				if($row_course=="0"){
				}
				else{	
					while($d = mysql_fetch_array($qry_course))	{				
						foreach( $colorList as $key => $value)
						{
							echo " update tblinquiry set total= '".$value."' where course='".$d['coursename']."' and inq_date='04/20/2008'";

						}						
						}

					}

 

1.) I want to have a mysql query wherein I can update my tblinquiry dbtable with the $value with the $course.

 

please help...

the query should be like this:

 

update tblinquiry set total='<total value>' where course='<coursename>' and inq_date='04/20/2008'.

 

the total value will come from the array

the coursename will come from the query

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.