Hello.
I need to hide all rows from a table. but i need to show a text ONLY the last raw added!
How can i do that? under the serch console to have " The last row was insered on $id"
Thank you verry much.
I apriciate your help. It is helping me a lot!
Last ID shown
Re: Last ID shown
This will select 1 row.
I used an iframe to add it to my site
Change to suite your database and fields
I used an iframe to add it to my site
Change to suite your database and fields
Code: Select all
<body>
<i>To post a message, Click the "Shout" button </i><p></p></p>
<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "databasename";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT field1, field2, field3 FROM tablename ORDER by `id` DESC LIMIT 0, 1";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
<div class="container"> echo "<table><tr><th>1 row</th><th>2 row</th><th>3 row</th></tr>";
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<tr><td>" . $row["field1"]. "</td><td>" . $row["field2"]. "</td><td>" . $row["field3"]. "</td></tr>";
}
echo "</table></div>";
} else {
echo "0 results";
}
$conn->close();
?>
</body>
23.17