Welcome Guest, Not a member yet? Register   Sign In
Append variable to column name during select statement
#8

[eluser]obiron2[/eluser]
Personally, I think your way is quite nice as it definately uses DRY (Don't Repeat Yourself) code.

The only suggestion i would make is to create an array of the field names you want to bring back as well as the $var suffix and I would build the SELECT part of the statement by looping through the array. this way you can pass the $var and $array to a generic query. this saves you from having to store different queries if there are different types of data you require (e.g. Image caption, Alt Text, Copyright, menu link URL)

Obiron


Messages In This Thread
Append variable to column name during select statement - by El Forum - 04-19-2009, 09:32 AM
Append variable to column name during select statement - by El Forum - 04-19-2009, 09:40 AM
Append variable to column name during select statement - by El Forum - 04-19-2009, 10:32 AM
Append variable to column name during select statement - by El Forum - 04-19-2009, 12:36 PM
Append variable to column name during select statement - by El Forum - 04-19-2009, 01:57 PM
Append variable to column name during select statement - by El Forum - 04-19-2009, 02:06 PM
Append variable to column name during select statement - by El Forum - 04-19-2009, 02:11 PM
Append variable to column name during select statement - by El Forum - 04-20-2009, 09:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB