No, it should not return what you want. When you do $orderid = mysql_query($query); all this does is actually execute the query, and returns an array containing the actual result set.
What you need to do from here is to do: $myrow = mysql_fetch_assoc($orderid); Now, what you have is an associative array in $myrow containing the row with identifiers being the collumn names in the db, So, from your query, you should do: $my_id = $myrow["orderid"]; $my_id will now contain the id you want... On Fri, 2002-11-01 at 10:21, Steve Jackson wrote: > This is the query I am running on my database: > > $query = "select orderid from receipts order by receipt_id DESC LIMIT > 0,1"; > $orderid = mysql_query($query); > > That should return the last record in the DB? Correct? > > I currently get a number returned which is the number plus 1. > IE if 423 is the last DB record then 424 is returned. > > Any ideas why this happens? > > Also in the same table I have a shipping price variable. > My query for this is: > $query = "select shipping from receipts order by receipt_id DESC LIMIT > 0,1"; > $shipping_cost = mysql_query($query); > > Again this should return the last record? > It doesn't return anything however. Any ideas? > > Steve Jackson > Web Developer > Viola Systems Ltd. > http://www.violasystems.com <http://www.violasystems.com/> > [EMAIL PROTECTED] > Mobile +358 50 343 5159 > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php