Killua Posted October 26, 2012 Share Posted October 26, 2012 Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in ------- on line 30 <?php include 'dbconfig.php'; echo "<center><big>Inputan Transaksi Jual</big></center>"; if(isset($_GET['action'] ) && ($_GET['action'] == 'delete')){ mysql_query("delete FROM sales where id_sales='".mysql_real_escape_string($_GET['id'])."'"); } $idsales=$_POST['jual']; $namasales=$_POST['sales']; $idbar=$_POST['kd_barang']; $namabar=$_POST['nama_barang']; $jumlahjual=$_POST['jumlah_barang']; $jumlahkembali=$_POST['jumlah_kembali']; $tglambil=$_POST['tanggal_jual']; $sql="insert into transaksijual values('".$_POST."','".$_POST['jual']."','".$_POST['sales']."','".$_POST['kd_barang']."','".$_POST['nama_barang']."','".$_POST['jumlah_barang']."','".$_POST['jumlah_kembali']."','".$_POST['tanggal_jual']."')"; if (! $result=mysql_query($sql, $dbh)) { echo mysql_error(); return 0; } echo "<table border='1'>"; echo "<tr><td>ID Nomor Sales<td>Nama Sales<td>Kode Barang<td>Nama Barang<td>Jumlah Barang<td>Jumlah Kembali<td>Tanggal Jual</tr>"; $sql = "select max(id) as id_sales from sales limit 1"; $row = mysql_fetch_array(mysql_query($sql)); $id_sales = $row['id_sales']; { foreach($_POST['kd_barang'] as $key => $kode){ $sql = "insert into transaksijual(nomor_tjual,id_sales,nama_sales,kd_barang, nama_barang,jumlah_barang,jumlah_kembali,tanggal_jual) values ('{$_POST}','{$_POST['jual']}','{$_POST['sales']}','{$idbar}','{$_POST['nama_barang'][$key]}','{$kode}','{$_POST['jumlah_barang'][$key]}','{$_POST['jumlah_kembali'][$key]}','{$_POST['tanggal_jual'][$key]}')"; mysql_query($sql); } echo 'Data telah disimpan'; echo "<tr>"; echo "<td>".$row[0]; echo "<td>".$row[1]; echo "<td>".$row[2]; echo "<td>".$row[3]; echo "<td>".$row[4]; echo "<td>".$row[5]; echo "<td>".$row[6]; echo "<td>"; echo '<a href="updaterincianjual.php?id='.$row['0'].'">Edit</a>'; echo ' | <a href="simpan-jual.php?id='.$row['0'].'&action=delete">Delete</a>'; echo "</td>"; echo "</tr>"; } echo "</table>"; ?> <html> <body> <form action='welcome.php'> <input type='submit' value='Home'> </form> </body> </html> <?php mysql_close(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/269927-php-help-me/ Share on other sites More sharing options...
requinix Posted October 26, 2012 Share Posted October 26, 2012 I don't know what inspired you to put this in the math section... JFGI Quote Link to comment https://forums.phpfreaks.com/topic/269927-php-help-me/#findComment-1387846 Share on other sites More sharing options...
MDCode Posted October 26, 2012 Share Posted October 26, 2012 I'd love not having to count lines, and deal with looking through plain text. Please at least tell us which line is 30 Quote Link to comment https://forums.phpfreaks.com/topic/269927-php-help-me/#findComment-1387952 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.