Re: Posting a variable
| From: | Robert Cummings | Date: | Wed, 11 Apr 2007 18:35:57 +0000 |
| Subject: | Re: Posting a variable | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-252616@lists.php.net to get a copy of this message | ||
On Wed, 2007-04-11 at 10:53 -0700, siavash1979@telus.net wrote:
> Quoting Robert Cummings <robert@interjinn.com>:
>
> > On Wed, 2007-04-11 at 09:59 -0700, siavash1979@telus.net wrote:
> > > 1- your mysql query statement is better to have a WHERE part too.
> > > 2- I would use mysql_fetch_row instead of mysql_fetch_assoc
> >
> > Ummm, why would you want to reduce clarity and maintainability by using
> > mysql_fetch_row()?
>
> hmmm, I just remember in my php class a while back, my teacher didn't even
> bother teaching us about mysql_fetch_assoc, and when a student asked about it,
> he said don't bother using it, just use mysql_fetch_row so I ended up using this
> function ever since. I'm guessing he was wrong??
It's a terrible idea-- to grok the code you need to keep referring back
to the query itself so that you can remember what index maps to what
field. I guess that's not so much a problem if you export the row values
to variables, but then again, why do in userspace what the
mysql_fetch_assoc() function readily does for you in engine space? :)
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'