17-01-2009, 22:01
|
|
|
חבר מתאריך: 06.06.07
הודעות: 749
|
|
קוד PHP
קוד PHP:
<?php header('Content-Type: text/html; charset=utf-8'); if(isset($_POST['newemployee']) && $_POST['newemployee'] == 'newemployee' ) { require("db.php"); //mysql_query("SET NAMES 'hebrew'"); if ( $_POST['textfirst']!=NULL && $_POST['textlast']!=NULL) { $query1 = "SELECT * from selery"; $res = mysql_query($query1,$link) or die(mysql_error()); $canput = 0; while( $row = mysql_fetch_array($res) ) { if ( !strcmp($row['firstname'],$_POST['textfirst']) && !strcmp($row['lastname'],$_POST['textlast']) ) { $canput = 1; break; } } if ( !$canput ) { $query = "INSERT INTO selery (firstname, lastname,waiter,manager,host,messenger,telephonist ,chef,cookn,cooks,barman) VALUES ('".$_POST['textfirst']."', '".$_POST['textlast']."', '".$_POST['textwaiter']."' , '".$_POST['textmanager']."' , '".$_POST['texthost']."' , '".$_POST['textmessenger']."' , '".$_POST['texttelephonist']."' , '".$_POST['textchef']."' , '".$_POST['textcookn']."' , '".$_POST['textcooks']."' , '".$_POST['textbarman']."')"; $res = mysql_query($query ,$link); //echo mysql_errno($link) . ": " . mysql_error($link) . "\n"; } else { echo "<font color='red'><h3><b>העובד רשום במערכת</b></h3></font>"; } } mysql_close(); } ?>
|