Page 1 of 1

Just need a set of fresh eyes - while()

Posted: Mon Jul 30, 2007 10:52 pm
by LiveFree
Hey All,

I've been working with the query jCart provided to me (thank you, again) and I cannot see why all I see echoed (other than the table outside of the loop), is "Below Echo Outside of While". I do not see any of the echos that should execute inside the while loop.

I cannot see why that loop is not executing, the functions are correct and everything, could someone talk a look for any simple mistakes I made?

Thanks

(And BTW - It does return the specific amount of results it should, the query is fine, but the output is not outputting)

Code: Select all

global $prefix, $db;
OpenTable();

#Thanks jCart from DevNetwork for this query

$sql = $db->sql_query('
SELECT * FROM `sacom_docs`
INNER JOIN `sacom_docs_access` USING (`docID`)
WHERE `sacom_docs_access`.`groupID` IN ('. implode(', ', array_keys($userinfo['groups'])) .')
  AND `sacom_docs`.`docID` = `sacom_docs_access`.`docID`') OR DIE (mysql_error());

echo "<table width=\"503\" height=\"83\" border=\"0\">
  <tr>
    <th width=\"107\" height=\"23\" bgcolor=\"#000000\" scope=\"col\"><span style=\"color: #FFFFFF; font-weight: bold;\">Download</span></th>
    <th width=\"99\" bgcolor=\"#000000\" scope=\"col\"><span style=\"color: #FFFFFF; font-weight: bold;\">Title</span></th>
    <th width=\"85\" bgcolor=\"#000000\" scope=\"col\"><span style=\"color: #FFFFFF; font-weight: bold;\">Creator</span></th>
    <th width=\"194\" bgcolor=\"#000000\" scope=\"col\"><span style=\"color: #FFFFFF; font-weight: bold;\">Upload Date</span></th>
  </tr>";
echo "Below Echo";
while ($data = $db->sql_fetchrow($sql)) {
 echo "Inside While";
		echo "<tr>
    <td height=\"23\" bgcolor=\"#000000\"><div align=\"center\"><a href='modules/" . $module_name . "/uploads/Documents/" . $data['docFilename'] . "'><img src=\"modules/SACOM/download.gif\" width=\"40\" height=\"40\" /></a></div></td>
    <td bgcolor=\"#000000\">" . $data['docTitle'] . "</td>
    <td bgcolor=\"#000000\">" . $data['docUploader'] . "</td>
    <td bgcolor=\"#000000\">" . $data['docUploadDate'] . "</td>
  </tr>";
  echo "End of While";
}
echo "Outside of While";
echo "</table>";

CloseTable();
Thanks Again

Posted: Tue Jul 31, 2007 2:38 am
by Gente
Are you sure the result of your query isn't empty?