Jump to content

How do I submit a custom MySQL query?

mysql query

  • Please log in to reply
2 replies to this topic

#1 norse2



  • Members
  • Pip
  • 1 posts

Posted 26 February 2016 - 07:17 AM

I want to have a function that will execute a query similar to this:


"DELETE * FROM 'my_table' WHERE 1"


This will allow me to let the user clear a table without going through the trouble of individual deletes.


I looked at this post



but I ran into the same error that is described in reply #9


Fatal error: Call to a member function result() on a non-object in /public_html/control/application/models/custom_query_model.php on line 18



Is there a better way to accomplish this and if not, then how do I get around this error?


Thank you in advance for your help.

#2 jamun567



  • Members
  • Pip
  • 4 posts

Posted 29 February 2016 - 09:47 AM

hello friends,

Accessing structured data with SQL is quite different from the full text search of documents on the Web. Structured data in the relational model means data that can be represented in tables -- rows and columns. Each row in a table represents a different object, and the columns represent various "attributes" of the object. The columns have names and integrity constraints that specify valid values.
Since the column values are named and are represented in a consistent format, you can select rows very precisely, based on their contents. This is especially helpful in dealing with numeric data. You can also join together data from different tables, based on matching column values. You can do useful types of analysis, listing objects that are in one table and missing (or present, or have specific attributes) from a related table. You can extract from a large table precisely those rows of interest, regrouping them and generating simple statistics on them.

#3 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts
  • LocationMumbai, India

Posted 01 March 2016 - 09:43 AM

Well my friend you dont need to have a GC function to make a call you can create a model having such queries ... call it from the controller - make the call to the function in controller .. done - thats it ... all done.


Happy GCing :)

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users