PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
This code works fine when only one of the columns in mysql has been set with a value and the name and filename process correctly. I'm having problems when both values have been set I only get the first one's name and filename to be popped into the array. The result from the query is has follows: Lit1 =1 and Lit 2 =1, but only Lit1 is executed. What I'm I doing wrong?
functionName{
while ($row = mysql_fetch_array($result))
{
if($row['LIT1'] != NULL)
{
$name = "1.pdf";
$fileName = "../pdf/1.pdf";
$updat= "update master set LIT1SENT='1' where UF13='$email'" ;
$rs = mysql_query($updat, $web)
or die('Could not query:' .mysql_error());
}
else
if($row['LIT2'] != NULL)
{
$name= "2.pdf";
$fileName = "../pdf/2.pdf";
$updat= "update master set LIT2SENT='1' where UF13='$email'" ;
$rs = mysql_query($updat, $web)
or die('Could not query:' .mysql_error());
}
There are a number of others..........
$docData = Array();
$aDoc['name'] = $name;
$aDoc['data'] = $data;
$docData[] = $aDoc; // store file data in list of all files (appends to array)
}
return $docData;
}
around code snippets.[/b][/color]
I have removed the else statement and I get the last document in the array, but not the first one. So the problem is , I think I'm overwriting the array and only the last value is in. I’m not sure how to fix it.