hey i am trying to execute a query statement here is my code below

$sel="SELECT course_name,course_code FROM courses WHERE course_name='$diff'";
					
					if ($result2=mysql_query($sel))
						{echo"nice";
					   }
					   else
					   {
					   echo "shit";
					   }
					while ($row2 = mysql_fetch_row($result2))
				{ 
					echo"row[0] : row[1] <br>";
					}

please note that the $diff variable is an array
while there is a result cause is shows nice on the screen i am just getting nothing in row[] i tried counting the results and found out it is 0 even though i am getting nice for the $result2
can some one offer some assistance on this matter
thanks

how to select rows with array?

first you implode that array $diff. after you select row with each variable which is in array. then count.

i want to do a query with each variable that is in the Diff array and just give me a result of each query that is what i am trying to achieve

Try changing $diff to $diff[0]. You need to reference an array element

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.