Can someone help me with this function...
I used the implode function but the problem I am now getting is that after using implode I can only search the database and return a result when there is only one item stored in the array, when there is more than one item (Blah1,Blah2,Blah3,Blah4) in the array it returns 0 Rows. Here is the code...
<?php /* Program: Stats.php Desc: Allows users to select the required variables to create statistics. */ /* Function to start session */ session_start(); ?> <html> <head> <title>Horse Racing Stats</title> </head> <body topmargin = "0" leftmargin = "0" marginheight = "0" marginwidth = "0"> <table width = "100%" border = "0" cellpadding = "5" cellspacing = "0"> <tr> <!-- Create page header --> <td height = "10%" colspan = "3" align = "center" valign = "top"> <font color = "gray" size = "+2"> <b>Selected statistics</b> </font> </td> </tr> <?php /* Read file that stores connection variables */ include("Lame.inc"); /* Connect to server and database */ $MakeCon = mysql_connect($hostserver, $username, $pass) or die ("Could not connect to server."); $ConnDB = mysql_select_db($db, $MakeCon) or die ("Could not connect to database."); $Coursearray = implode(",", $Course); $SqlQueryA = "SELECT Course_Name FROM tblMeeting WHERE Course_Name IN ('$Coursearray')"; $SqlResA = mysql_query($SqlQueryA) or die ("Could not execute query"); $NumRows = mysql_num_rows($SqlResA); /** This shows the inside of the array for testing purposes**/ echo "$Coursearray\n\n"; /** This shows how many records have been returned for testing purposes **/ echo "$NumRows ROWS"; ?> </table></body></html>
Here is an image of the result (that works) when only one item in the array:-
Here is an image of the result (that fails) when more that one item is in the array:-
Please can someone help me... thanks
[attachment deleted by admin]