Mailinglisten-Archive |
This is a multi-part message in MIME format.
------=_NextPart_000_0009_01BF97F7.7CA704A0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
hi
ich wollte =FCberpr=FCfen, ob eine tabelle daten enth=E4lt
oder nicht.=20
wenn die tabelle nicht leer ist wir ganz normal die=20
else anweisung ausgef=FChrt. wenn sie leer ist=20
stoppt die ausgabe vor oder bei der if anweisung.
es wird also weder if noch else noch der html body
ausgegeben.
mit folgendem code hab ich es probiert:
$query =3D "select * from products order by name";
$result =3D mysql_db_query($database, $query);
$num =3D mysql_numrows($result) or die(mysql_error());
if ($num =3D=3D 0)
{
echo "No data found in the database";
}
else
{
.....
}
echo "</body>";
echo "</html>";
danke schon mal
sandro pilch
p.s. sorry, das ich in meinem urlencode posting so=20
ungeduldig war und nach ein paar stunden nochmals=20
nachgefragt habe!
------=_NextPart_000_0009_01BF97F7.7CA704A0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>hi</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>ich wollte =FCberpr=FCfen, ob eine =
tabelle daten=20
enth=E4lt</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>oder nicht. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>wenn die tabelle nicht leer ist wir =
ganz normal die=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>else anweisung ausgef=FChrt. wenn sie =
leer ist=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>stoppt die ausgabe vor oder bei der if=20
anweisung.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>es wird also weder if noch else noch =
der html=20
body</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>ausgegeben.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>mit folgendem code hab ich es=20
probiert:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> $query =3D "select * from =
products order by=20
name";<BR> $result =3D mysql_db_query($database, =
$query);<BR> $num =3D=20
mysql_numrows($result) or die(mysql_error());</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> if ($num =3D=3D =
0)<BR> {<BR> echo=20
"No data found in the database";<BR> }</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>else</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>{</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>.....</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> echo =
"</body>";<BR> echo=20
"</html>";</FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>danke schon mal</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>sandro pilch</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>p.s. sorry, das ich in meinem urlencode =
posting so=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>ungeduldig war und nach ein paar =
stunden nochmals=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>nachgefragt =
habe!</FONT></DIV></BODY></HTML>
------=_NextPart_000_0009_01BF97F7.7CA704A0--
__________________________________________________________________
Do You Yahoo!?
Gesendet von Yahoo! Mail - http://mail.yahoo.de
Yahoo! Auktionen - gleich ausprobieren - http://auktionen.yahoo.de
php::bar PHP Wiki - Listenarchive