Forum Moderators: coopster
I have a table in a database, the first entry in the table might have an id of 4 or and id of 6 depending on what has been added/deleted.
is there a way to select only the first record in the database and determine the id?
sort of like
SELECT id FROM table ORDER BY id ASC LIMIT 1
then something like $id = $row['id'];
can anyone confirm if this is the correct way to go about it or if there is a better way?
<?php
include '/home/www/juttuffi/dbc.php';
$query = mysql_query("SELECT qid FROM tquestions ORDER BY qid ASC LIMIT 1") or die(mysql_error());
$row = mysql_fetch_array($query,MYSQL_ASSOC);
$id = $row['qid'];
if(isset($id))
{
echo $id;
}
else
{
echo "wrong";
}
mysql_close($dbc);
?>