
error en php con mysql
Publicado por JOSE FERNANDO (3 intervenciones) el 22/11/2021 07:47:18
buenas noches, espero me puedan ayudar, tengo el siguiente codigo pero no funciona, necesito hacer una consulta a mysql pero con un where no puedo obtener el id de in input
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<input class="form-control" type="text" name="idpedido" id="idpedido" value="">
<div class = "clase2" id="misdatos">
<table id="mydatatable" class=" table table-bordered table-striped table-hover ">
<thead>
<tr style="background-color: black">
<th style="color: white" >Id</th>
<th style="color: white" >idpedido</th>
<th style="color: white" >Idproducto</th>
<th style="color: white" >Precio</th>
<th style="color: white" >Cantidad</th>
<th style="color: white" >Subtotal</th>
</tr>
</thead>
<tbody id="prod">
<?php
$pidpe = $_POST['idpe'];
$servername = "********";
$username = "*****";
$password = "******";
$dbname = "****";
$conn = mysqli_connect($servername, $username, $password, $dbname) or die("Connection failed: " . mysqli_connect_error());
echo "<script> alert('".$pidpe."'); </script>";
$sqli = "SELECT * FROM detalle_ped WHERE idpedido= 2";
$resultset = mysqli_query($conn, $sqli) or die("database error:". mysqli_error($conn));
while($row= mysqli_fetch_assoc($resultset))
{
?>
<tr id="id" style=" color: #3E0202 " >
<td id="id"><?php echo $row ['iddetalle_pedido']; ?></td>
<td><?php echo $row ['idpedido']; ?></td>
<td><?php echo $row ['idprod']; ?></td>
<td><?php echo $row ['precio']; ?></td>
<td><?php echo $row ['cantidad']; ?></td>
<td><?php echo $row ['subtotal']; ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
Valora esta pregunta


0