MarPlo
-
Posts
80 -
Joined
-
Last visited
Posts posted by MarPlo
-
-
Hy,
Here's an example that gets the las inserted id (I use MySQLi):
<?php // connect to the "tests" database $conn = new mysqli('localhost', 'root', 'pass', 'tests'); // check connection if (mysqli_connect_errno()) { exit('Connect failed: '. mysqli_connect_error()); } // sql query for INSERT INTO users $sql = "INSERT INTO `users` (`name`, `pass`, `email`) VALUES ('PloMar ', 'love_light', 'a_name@domain.net')"; // Performs the $sql query and get the last insert auto ID if ($conn->query($sql) === TRUE) { echo 'The auto ID is: '. $conn->insert_id; } else { echo 'Error: '. $conn->error; } $conn->close(); ?>
-
Hy,
Try with Join, or Left Join:
SELECT * FROM `table1` LEFT JOIN `table2` ON `table2`.`id`>0 DESC LIMIT 2
-
Hy,
I tested this code and it works:
<?php setcookie('keyval', '3', time()+3600); echo 'COOKIE set'; ?>
You can get the cookie with $_COOKIE['keyval'], on any session.
-
Try the second $sql like this:
$sql = "SELECT `name`, `link` FROM `menu` WHERE `category`='$top'";
-
I'm new here too.
I also try to lern what I can do well
Just hy from me, too.
-
Hy everyoane
I just received to discover this forum, so I'm new, allways new.
With respect for everyone,
Marius
-
Hy
I'm new here.
I try to lern good and useful things if God helps me.
last updated and created dates
in MySQL Help
Posted
Hy,
You can get the last row in your table by sorting DESC, and LIMIT 1.