[thelist] php/mysql - two consecutive select statements
Jay Greenspan
jay at trans-city.com
Fri Nov 16 09:57:24 CST 2001
On Friday, November 16, 2001, at 10:18 AM, Dave Preston wrote:
> Wow, that's pretty scary.. I'd *strongly* urge you to ditch using list
> and use mysql_fetch_obj instead of mysql_fetch_row. The main reason
> being that if you ever change your schema, you'll be screwed if you
> forget to update any of your php scripts.
Dave, I'm not sure what you mean here.
> $obj = mysql_fetch_object($job_query, MYSQL_ASSOC);
> $client_id = $obj->client_id;
Um, OK, but if the schema changes, you'll still have to update your
script. I mean,
if the schema changes, the query will change. If $client_id is in the
result it can
just as easily be assigned to a scalar variable with
list()=mysql_fetch_array() as it can with
mysql_fetch_object(). Right? It seems to me that this is an additional
step which
requires a bit (really a trivial amount) more memory allocation but
doesn't really
get you anything unless you're a huge fan of PHP OO syntax.
It's quite possible that I'm just too stupid to see your point. Would
you mind clarifying
for me?
-j
More information about the thelist
mailing list