dyela Posted May 10, 2007 Share Posted May 10, 2007 ??? please somebody help me if (!mysql_num_rows($result)) { echo "<script languange = 'Javascript'> alert ('Harap maaf'); location.href='bar_code.php'; </SCRIPT>"; } else { } this coding for what?? i want to no when to use if...the function Quote Link to comment https://forums.phpfreaks.com/topic/50745-please-somebody-help-me/ Share on other sites More sharing options...
btherl Posted May 10, 2007 Share Posted May 10, 2007 It means this: If the database query gave no results, then echo "<script ..." Otherwise, if there WERE database results, do nothing. The person who wrote it is using the fact that "0" is treated as "false" by php. Quote Link to comment https://forums.phpfreaks.com/topic/50745-please-somebody-help-me/#findComment-249481 Share on other sites More sharing options...
dyela Posted May 10, 2007 Author Share Posted May 10, 2007 <HTML> <HEAD> <TITLE>Maklumat terperinci pelajar</TITLE> </HEAD> <style type="text/css"> <!-- .style1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #0092C1; font-weight: bold; } .style6 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #CC6600; font-weight: bold; } .style2 {color: #CC6600} .style7 {color: #000000} --> a, A:link, a:visited, a:active, A:hover { color: #0000ff; text-decoration:none; font-family:Verdana, Arial, Helvetica, sans-serif; font-size: 11 px} .style9 {font-size: 10px; color: #0092C1; font-family: Verdana, Arial, Helvetica, sans-serif;} body { background-color: #F8F8F8; } </style> <? include ("mysql.php"); $string = date("Y-m-d"); /* //$id=$_POST['id']; $q1 = "select * from insert_pelatih_keluar where dateout ='$string'"; $r1=mysql_query($q1); //use of fetch array while($row=mysql_fetch_array($r1)){ $id=$row["id"]; $masakeluar=$row["timeout"]; $tujuan=$row["tujuan"]; $butiran=$row["butiran"]; } //echo "<tr><td><a href=display.php?id=$id>Daftar Pelatih</a></td><td>$nama</td> <td>$nodaftar</td><td>$kursus</td></tr>"; $q = "select * from daftar_pelatih where id='$id'"; $r=mysql_query($q); //use of fetch array $row=mysql_fetch_array($r); $nama=$row["nama"]; //if(mysql_error()){echo mysql_error();} $id=$row["id"]; $nodaftar=$row["no_daftar"]; $kursus=$row["kod_kursus"]; */ ?> <body> <form method="POST" action="display.php"> <TABLE style="border-style:solid; border-color:#666666; background:#E0E0E0; " width="699" border="2" > <TR> <TD>Sila masukkan maklumat anda di bawah</TD> <tr></tr> </TR> <TD>No matrik : <input type="text" name="no_daftar" size="20"></TD> <TR> <TD><input type="submit" name="cari" value="Cari"></TD> </TR> </p> </form> <form> <TABLE style="border-style:solid; border-color:#666666; background:#E0E0E0; " width="699" border="2">   <TR>Senarai pelajar yang keluar pada hari ini </TR> <tr> <TD>Nama Pelajar</TD> <TD>No Matrik</TD> <TD>Kod Kursus</TD> <TD>Masa Keluar</TD> <TD>Tujuan</TD> <TD>Butiran</TD> </tr> <? $q1 = "select * from insert_pelatih_keluar where dateout ='$string'"; $r1=mysql_query($q1); //use of fetch array while($row=mysql_fetch_array($r1)){ $id=$row["id"]; $masakeluar=$row["timeout"]; $tujuan=$row["tujuan"]; $butiran=$row["butiran"]; $q2 = "select * from daftar_pelatih where id='$id'"; $r2=mysql_query($q2); //use of fetch array $row2=mysql_fetch_array($r2); $nama=$row2["nama"]; $nodaftar=$row2["no_daftar"]; $kursus=$row2["kod_kursus"]; echo "<tr><td>$nama</td><td>$nodaftar</td><td>$kursus</td><td>$masakeluar</td><td>$tujuan</td><td>$butiran</td></tr>"; } ?> </table> </form> </body> <a href="laporankeluar.php">Lihat Laporan</a> this is my project i want to no when i use the coding if (!mysql_num_rows($result)) { echo "<script languange = 'Javascript'> alert ('Harap maaf'); location.href='bar_code.php'; </SCRIPT>"; } else { } because only the matrik card in database only can go out.. Quote Link to comment https://forums.phpfreaks.com/topic/50745-please-somebody-help-me/#findComment-249484 Share on other sites More sharing options...
dyela Posted May 10, 2007 Author Share Posted May 10, 2007 Well,im very new for this programming...i know only the basic things So i really need ur help very much..my time to finish my project is very short. Ok..What are the php code that need to be use combo box and i want make appear the options to select. Can you help me with this coding whether its php or js.... Quote Link to comment https://forums.phpfreaks.com/topic/50745-please-somebody-help-me/#findComment-249501 Share on other sites More sharing options...
mmarif4u Posted May 10, 2007 Share Posted May 10, 2007 Hi man. Selamat pagi... Haraf maaf(From) For dropdown u have to a sql query then go for a while loop and in while loop array to retireive the data to select box. I think this will help u. Or if not plz post a reply i will try to help u out. Quote Link to comment https://forums.phpfreaks.com/topic/50745-please-somebody-help-me/#findComment-249504 Share on other sites More sharing options...
dyela Posted May 10, 2007 Author Share Posted May 10, 2007 ??? hmm..well im quit stuck with this matter can u please help me with this coding...i'm not very clear with what u say. Are u malay?? Quote Link to comment https://forums.phpfreaks.com/topic/50745-please-somebody-help-me/#findComment-249515 Share on other sites More sharing options...
mmarif4u Posted May 10, 2007 Share Posted May 10, 2007 Not malay but living here in malaysia std of UM. ok. So u want to display data from ur db in a select box. am i right. Quote Link to comment https://forums.phpfreaks.com/topic/50745-please-somebody-help-me/#findComment-249519 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.