Jump to content


New Members
  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About ramllo

  • Rank
  1. Hello everyone! I'm having issues with a delete button on a table row, im getting this error: Catchable fatal error: Object of class mysqli could not be converted to string in C:\xampp\htdocs\consultas\newdatapull.php on line 19 I'm not sure whats going on, here's my code: <?php include('header.php'); $servername = "localhost"; $username = "un"; $password = "admin"; $dbname = "emelyconsultas"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); }; if (isset($_POST['delete'])) { $deleteQuery = "DELETE FROM hoteles WHERE id='$_POST[delete]'"; mysqli_query("$conn, $deleteQuery, "); }; $sql = "SELECT id, Full_Name, Email_Address, Telephone_Number, pais, ciudad, nombre_hotel, fecha_in, Fecha_out, adultos, ninos, mensaje FROM hoteles"; $result = $conn->query($sql); if ($result->num_rows > 0) { echo "<div class='container-fluid'> <div class='col-md-12'> <div id='datatable'class='table-responsive well'> <h1 class='text-center'>Entradas</h1> <table id='table' class='table'> <tr> <th>ID</th> <th>Nombre</th> <th>Correo Electronico</th> <th>Numero Telefonico</th> <th>Pais Destinado</th> <th>Ciudad Destinada</th> <th>Hotel</th> <th>Check In</th> <th>Check Out</th> <th>Adultos</th> <th>NiƱos</th> <th>Mensaje</th> </tr>"; // output data of each row while($row = $result->fetch_assoc()) { echo "<form action=newdatapull.php method=post>"; echo "<tr>"; echo "<td>" .$row['id'] . " </td>"; echo "<td>" .$row['Full_Name'] . " </td>"; echo "<td>" .$row['Email_Address'] . " </td>"; echo "<td>" .$row['Telephone_Number'] . " </td>"; echo "<td>" .$row['pais'] . " </td>"; echo "<td>" .$row['ciudad'] . " </td>"; echo "<td>" .$row['nombre_hotel'] . " </td>"; echo "<td>" .$row['fecha_in'] . " </td>"; echo "<td>" .$row['Fecha_out'] . " </td>"; echo "<td>" .$row['adultos'] . " </td>"; echo "<td>" .$row['ninos'] . " </td>"; echo "<td>" .$row['mensaje'] . " </td>"; echo "<td>" .$row['id'] . " </td>"; echo "<td>" ."<input class=input-group type=submit name=delete value=Borrar>" . "</td>"; "</form>"; echo "</tr></table></div></div></div>"; } } else { echo "0 results"; } $conn->close(); include('footer.php'); ?> thanks in advance to anyone that can help, Error comes up once I click the Delete button on the row...
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.