Andu Jame Posted May 22, 2007 Share Posted May 22, 2007 can any1 help me?? Is that any error on this php code?? $ip1 = getenv('REMOTE_ADDR'); $q="select * from kawalan_punch where id_kursus ='$id_kursus'"; $row=mysql_fetch_array($r); $ip2=$row["ip_client"]; Quote Link to comment https://forums.phpfreaks.com/topic/52419-can-use-this-code/ Share on other sites More sharing options...
btherl Posted May 22, 2007 Share Posted May 22, 2007 $ip1 = getenv('REMOTE_ADDR'); $q="select * from kawalan_punch where id_kursus ='$id_kursus'"; $are = mysql_query($q) or die("Error in $q\n" . mysql_error()); $row=mysql_fetch_array($are); $ip2=$row["ip_client"]; I added a missing line. Where does $id_kursus come from? What do you want the code to do? Quote Link to comment https://forums.phpfreaks.com/topic/52419-can-use-this-code/#findComment-258694 Share on other sites More sharing options...
Andu Jame Posted May 22, 2007 Author Share Posted May 22, 2007 kawalan_punch is my db and $id_kursus is one of the row. $id_kursus is id for my workers....and i'm doing punch card system for attendance i want this code to verify according to $id_kursus. If $id_kursus is different it will show error msg Quote Link to comment https://forums.phpfreaks.com/topic/52419-can-use-this-code/#findComment-258700 Share on other sites More sharing options...
trq Posted May 22, 2007 Share Posted May 22, 2007 If $id_kursus is different it will show error msg Then you'll need some sort of check. <?php $q = "select * from kawalan_punch where id_kursus ='$id_kursus'"; if ($are = mysql_query($q)) { if (!mysql_num_rows($are)) { echo "id not found"; } else { $row = mysql_fetch_array($are); $ip2 = $row["ip_client"]; } } else { echo "Error in $q\n" . mysql_error(); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/52419-can-use-this-code/#findComment-258701 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.