php function->query(variable) what's that?
I can understand basic php and some php-mysql, but there is something I bumped into when reading some e-commerce scripts.
$rs = $objDB->query($sql); PHP Code:
Thanks. |
The "->" notation is used for classes. I'm not very good at it, but I think the syntax is "class->object_or_function_in_class". In your example objDB is the class and query is a function in that class. Have a look at php.net for more info.
|
$connectionObj->query() is...
Bebo is correct. It is a function of the pear db class. Your sql query is stored in the variable $sql. By itself, it does nothing. The pear db class is a means or a vehicle to access your database and tables. The "->query($sql) simply is a method (functions in classes are referred to as methods) that sends and executes your query on your database/table(s).
See more at: http://pear.php.net/manual/en/packag...ntro-query.php Description PEAR DB provides several methods for querying databases. The most direct method is query(). It takes a SQL query string as an argument. There are three possible returns: a new DB_result object for queries that return results (such as SELECT queries), DB_OK for queries that manipulate data (such as INSERT queries) or a DB_Error object on failure. |
pear query() method
Thanks a lot Bebo and YankeeFan
|
All times are GMT -5. The time now is 11:24 PM. |