Mioplanet Documentation Center
Resources and Help
HomeProductsMioScriptJavaScriptTechNotesPHP
   Home | PHP | LIB_MIODB_PHP | mioDb_query SEARCH    

  Functions
comma
copy
count
disk_file_list
disk_file_load
disk_file_save
disk_folder_copy
disk_folder_list
disk_folder_remove
explode
get_baseURL
get_currentPath
implode
mioDb_connect
mioDb_query
mioxml_getElement
mioxml_getElementArray
mioxml_getOuter
settingsSetSimpleValue
settingsStringToArray
settingsToArray
strlen
strpos
strrpos
strtolower
strtotime
strtoupper
str_decrypt
str_encrypt
str_posEx
str_replace
str_split
substr

  Libraries
miodb_lib.php
mio_wlib.php
stats_read.php
stats_write.php

Function
mioDb_query

Language: PHP
Product: MioDB


Syntax

mioDb_query(Database, Query, Fetch)


Parameters

STRINGDatabaseMySQL Database Name.
STRINGQueryValid MySQL query.
BOOLFetchFetch the row.
If this parameter is set to true, the function returns an array. The names of the columns are the names of the items in the array.
If the parameter is set to false, the function returns a MySQL resource or the query result.


Return value

Array or Query result.



Description

Selects a table, sends a query and, if the parameter fetch is set to true, fetch a result row as an associative array.

If the query returns more than one result, you must fetch the result with a for loop as shown in the sample below.




PHP Sample Code


$query = miodb_query("database", "SELECT * FROM TableName", false);
for($ptr = 0; $ptr < mysql_num_rows($q); $ptr++) {
    $data = mysql_fetch_array($query, MYSQL_BOTH);
    echo($data['ColumnName']."<BR>");
}