php not displaying what I want... ;) (SOLVED!)
Posted: Thu Dec 30, 2010 3:57 am
Hi,
I'm quite new to php as I programmed in asp before.
I now have a problem where I cannot see what is wrong:
am using a mssql db with adodb connection
($recordSet is the sql query.)
what should it do: if recordSet is empty then display the invoice-phrase, else a dropdown menue. The problem is that I always get a dropdown menue either empty or filled.
so I guess that recordSet is always recognized as not empty. How can I check if it's empty or not? (and please do not, like php users in German forums, refer to manual or google.)
I'm quite new to php as I programmed in asp before.
I now have a problem where I cannot see what is wrong:
am using a mssql db with adodb connection
Code: Select all
$recordSet = &$conn->Execute('SELECT max(uebkunden.id) as id, translat.rechid, uebkunden.name FROM translat INNER JOIN uebkunden ON translat.kunde = uebkunden.id WHERE (translat.rechid <> 0) AND (translat.rechn = 1) AND (translat.druck = 0) group by uebkunden.id, uebkunden.name, translat.rechid order by rechid');
if (!empty($recordSet)) {
if (!$recordSet) {
Echo ' <tr><td>No invoice to print</td></tr>';
} else {
echo '<tr><td><form name="marken" method="post"> ';
Echo ' <select size="1" name="kunde" onChange="document.marken.submit();">';
Echo ' <option value="">---Auswahl---</option> ';
while (!$recordSet->EOF) {
//maid = rs("id")
//mbez = rs("name")
//rechidi = rs("rechid")
Echo ' <option value="'.$recordSet->fields['id'].'" ';
Echo ' >'.$recordSet->fields['name'].' '.$recordSet->fields['rechid'].'</option> ';
$recordSet->MoveNext();
}
}
echo ' </select></td></tr>';
} else {
Echo ' <tr><td>No invoice to print</td></tr>';
} what should it do: if recordSet is empty then display the invoice-phrase, else a dropdown menue. The problem is that I always get a dropdown menue either empty or filled.
so I guess that recordSet is always recognized as not empty. How can I check if it's empty or not? (and please do not, like php users in German forums, refer to manual or google.)