4

storing into an array

view full story
linux-howto

http://www.daniweb.com – can anyone offer some help here i have a string that contains course codes. i separate the string into the individual course codes using the explode function. however i want to run a query on each of the course codes that was present in the string and store the result in an array that i have created this is the code that i have thus far <?php $hostname = "localhost"; $username = "root"; $password = "hayden"; $database = "ecng3020"; $con = mysql_connect("$hostname","$username","$password"); if (!$con)   {   die('Could not connect: ' . mysql_error());   }   mysql_select_db("$database", $con);     $q="SELECT * FROM rules Where type ='course_option'  ";   if ($result_2=mysql_query($q))   {           echo"nice";   }   else   {           echo"shit";   }                                                                                                 while($row = mysql_fetch_assoc($result_2))         {                         extract($row);                         echo "<p>$parameters</p>";                         $e=explode(",",$parameters);                         print_r($e);                                                 $w="SELECT * FROM student_courses WHERE course_status='pass' AND course_code='$e' AND id_no=806000169";                                                 if ($result1=mysql_query($w))                           {                                 echo"nice";                           }                           else                           {                                 echo"shit";                           }                           while($row1 = mysql_fetch_assoc($result1))                           {                                   extract($row);                                 echo "<p>$course_status</p>";                           }                         }         ?> as you can see i have not created the array to store the results of the query cause i am experiencing some problems with the final query for some reason it is not working can some one offer some assistance please thanks (General)