Retrieving Rows - Can I Change The Order?

From: Date: Thu, 26 Jul 2001 06:46:52 +0000
Subject: Retrieving Rows - Can I Change The Order?
Groups: php.db 
Request: Send a blank email to php-db+get-10787@lists.php.net to get a copy of this message
Hi all I think this should be a nice easy one... I get a select * query, then I start checking what values are in certain columns for a given row. Usually I do something like if ($row[3] == "1") { // do something } else { // do something else } OK - nice and easy. Now then, I have changed a column in the table, and the only way I found to change a data type is to delete the offending column and then add it again. When I do the select now the new column, which was at $row[3] is now always $row[39]. I don't mind this, because I know where it is, but is there any way I can make it appear at $row[3] again? I'm sure you can imagine when there are quite a few pages using this code it's easier to reorder the columns in the select than to change all my if() codes! By the way, I know I can be explicit by SELECTing each column by name, but I'ds rather use a SELECT * fror this partucular instance. Any ideas? Or am I just being lazy (it's been a long night after all!)? TIA Dave

« previous php.db (#10787) next »