PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Maybe those queries don't return any results? So then the while loop will never execute and those variables will never be set, but you echo them anyway.
In addition, why do you have 2 queries for the same table with the same condition for two different fields?
$query1 = 'SELECT path, nume FROM stiri WHERE id=LAST_INSERT_ID()';
$results1 = mysql_query($query1) or print(mysql_error());
if(!$results1) {
echo "No records found!";
}
while($line = mysql_fetch_assoc($results1)) {
echo "<vid src=\"{$line['path']}\" desc=\"{$line['nume']}\"/>\n";
}
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
It should at least say "No records found!" if you did it properly.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Also, if I remember correctly, you must have had an insert on that same connection in order to get the LAST_INSERT_ID().
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
It seems that in your scenario you want the latest addition regardless of what client or connection added it (newest addition). In that case you could use max(id), though I would prefer to add a timestamp field is set when you insert and use that. So you would also use a LIMIT 1 since you know you only want 1 record, and you don't need a loop for the results.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.