pquery Posted June 23, 2008 Share Posted June 23, 2008 I've been trying to figure out what this page has been barking about for half the afternoon now.... I keep getting the same number of fetch array warnings as that are built for my array which is generated, I just don't know if I'm missing a comma or semi or what, because I've inserted it in my DB as a straight SQL query using a number of the values that have been echoed out and it gives me exactly the data that I'm looking for... WHILE ( $row = mysql_fetch_array($result2)) { $i++; $candidates[] = $row['applicationID']; } //print_r($candidates); //misc functions mysql_select_db("$db2_name")or die("cannot select DB"); echo " Origional I value = $i <br />"; //foreach ($candidates as &$value) { WHILE ( $i != 0 ) { //echo "canidate $i = $candidates[$i] <br />"; $value = $candidates[$i]; //$sql = "SELECT applicationID, firstName, lastName FROM applicants WHERE applicationID = '$value';"; $sql = "SELECT t1.applicationID, `firstName` , `lastName` , `applicantPosition` FROM `applicants` AS t1 LEFT JOIN applicantposition AS t2 ON ( t1.applicationID = t2.applicationID ) WHERE t1.applicationID = '$value';"; echo "value = $candidates[$i] <br />"; $result = mysql_query($sql); [b]$row1 = mysql_fetch_array($result);[/b] // this is where it barks every single time and hence there's no array to for the insert statement later I've tried my query with $candidates[$i] and then subsuiting $candidates[$i] for $value to see if that made any difference, I've tried a for loop and and while loop countdown to see if that would help and now I'm stuck at the moment. Your help is appreciated as always (I'm hoping it's something simple and stupid I'm overlooking) Link to comment https://forums.phpfreaks.com/topic/111561-this-fetch-array-warning-is-driving-me-crazy/ Share on other sites More sharing options...
DarkWater Posted June 23, 2008 Share Posted June 23, 2008 AJHASJKDHAS. *Explodes* You have to add error-checking to your MySQL queries, there must be someting causing it to fail, which makes mysql_fetch_array() "bark" at you. $result = mysql_query($sql) OR die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/111561-this-fetch-array-warning-is-driving-me-crazy/#findComment-572648 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.