Pulling select fields from records
5 posts by 3 authors in: Forums > CMS Builder
Last Post: December 16, 2010 (RSS)
Normally, it would be something like:
SELECT title FROM <table>....
I can't see anyway to limit the fields that are selected using the commands that are accepted by CMS Builder.
Help?
Websites That Work
Re: [Mr Jim] Pulling select fields from records
By Jason - December 16, 2010
There isn't an option to limit the fields being returned by getRecords. The quickest way to do this would be to just use straight sql.
If you're interested, we can accomplish this for you with some customization.
Can you give an example where you would need to limit the number of fields returned without using plain sql?
Let me know.
Thanks
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Pulling select fields from records
As you said, I'll probably just go ahead and write this using regular sql.
Websites That Work
Re: [Mr Jim] Pulling select fields from records
By Chris - December 16, 2010
Sometimes straight SQL is the way to go. Something like this should work for you:
$escapedTableName = mysql_escape(getTableNameWithPrefix('my_section_name');)
$records = mysql_query_fetch_all_assoc("SELECT num, name FROM `$escapedTableName`");
showme($records);
I hope this helps! Please let me know if you have any questions.
Chris
Re: [chris] Pulling select fields from records
By MisterJim - December 16, 2010 - edited: December 17, 2010
Jim
Websites That Work