By ekitel on
why use Database abstraction layer instead of regular php mysql functions?
I normally use mysql_result() with 3 paramaters, but db_result() only takes 2, so I have no idea how to specify the field I want from a row with the result of a 'SELECT *' query
Comments
I see that it's a security
I see that it's a security issue, but I still don't see how I can use db_result without a 3rd parameter...
Not being a coder, does this
Not being a coder, does this page help?
http://drupal.org/node/62304
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide
db_result vs db_fetch_object
I only use db_result if my sql statement only returns a single field, something like this
If my query returns more than one field/column I do something like this
The documentation for php notes the later case is quicker if dealing with multiple columns.
thanks! like I said I'm
thanks! like I said I'm used to using a third parameter to specify the column, but I might have to switch to this db_fetch_object method if it's really going to create a major security problem
A little error in your code
A little error in your code there nevets.
You're using $results instead of $data as the object
Thanks! This provided part
Thanks! This provided part of the solution for a code snippet I was trying to write in this thread:
http://drupal.org/node/141458
Thanks again!
Drupal's so easy, even I could do it.
http://www.kfol.org/
Don't use SELECT *
Don't use
SELECT *then.SELECT {colname}instead and you'll only be retrieving the bit you want..dan.
How to troubleshoot Drupal | http://www.coders.co.nz/
.dan. is the New Zealand Drupal Developer working on Government Web Standards