Mysql Execute Query Operation

Description

Executes any mysql query and returns the result (returns result object in case of select query). Use this for running any other queries that can't be run using the other select,insert,update,delete functions

Function Reference :
dbExecuteQuery($query); 

Parameters

Name Type Required Parameter Info Example
query string Yes Query to be executed $query="select firstName,lastName,email from users where gender='male'"

Examples

 <?php 
$sdb= new SimplifiedDB(); 
$sdb->dbConnect("localhost","username","password","dbuser");
$query="select firstName,lastName,email from users where gender='male'";
$sdb->dbExecuteQuery($query);
?> 

Result

Executes the query.You can use this function to execute very complex queries like queries using varibles,multiple select statement in one query etc. If query is select operation then it returns mysql result set by default. You can set $sdb->output_array=true, to return array as output.

Debuging

Debug Operation Result/Output
$sdb->query select firstName,lastName,email from users where gender='male'
$sdb->last_insert_id 0
$sdb->rows_affected 5
$sdb->message_info Connected to database
$sdb->error_info

More Examples

<?php 
$query="select firstName,lastName,email from users where gender='male' and role_id='10'";
$result=$sdb->dbExecuteQuery($query); 
?>