Hi:
Looking at what Oberon stated, its true that the select statement is written wrong, it should read as follows:
PHP Code:
$result = mysql_query("SELECT * FROM order_desc ORDER BY order_no DESC LIMIT 0,1") or die("SELECT Error: ".mysql_error());
.
I'm just quoting the piece of code I'm working on as I've already connected and selected the database.
The following piece of code gets me all values in the row:
PHP Code:
$get_info = mysql_fetch_array($result, MYSQL_ASSOC);
Just to clear up the picture of what I'm trying to do: From a particular order form (order_info.html) data is sent to the table order_info and recorded in a particular row. As I'm trying to retrieve data only from the last row for my purposes, I need to get all data except order_no and any fields that may be null or have zero as value. Let me mention that a row consists of 16 fields but not all of them will be filled at any one time.
As an example, if the order consists of QTY_1, DESC_1, and QTY/PAGE1, that leaves me with 13 other fields that I don't want. What if instead of just 1 entry, there is one as follows:
QTY_1 DESC_1 QTY/PAGE1
QTY_2 DESC_2 QTY/PAGE2
QTY_3 DESC_3 QTY/PAGE3
how can I get just this data and nothing else. I must mention that after the entry of 3 different forms, a form must be produced using data that may exist on the last row only and that entries may consist of 3(4 with order_no) or 15(16 with order_no).
|