i5_query

 

Sends SQL request and possibly collects results set.

 

resource i5_query (

string query
[,
resource connection])

 

Detail

 

SELECT request type i5_query returns a resource in case of success or FALSE in case of error.

For UPDATE or DELETE request type, i5_query returns TRUE in case of success or FALSE in case of error.

 

i5_query function is the most suitable for all easy processing, without parameter requests, otherwise a parameterized request type like (i5_prepare and i5_execute) must be prepared.

 

Parameters

 

query

I5 SQL request to be performed

connection

Connection ID (optional)

  

Returns:

TRUE or SELECT request type ID or FALSE in case of failure. 

 

I5_ERR_DESC_WRONG_DATAOP

41

Wrong operation on a data field of a description

I5_ERR_PARSEXML

42

Internal error; please contact Aura Equipement; error number 42

I5_ERR_PHP_OPTIONSTYPE

259

The type of " I5_OPTIONS_ALIAS" option must be x and not x

I5_ERR_PHP_OPTIONSNUMBER

260

Option number -1 is unknown.

 

 

Example:

 

 

/* Straight request execution */

$query = i5_query('SELECT * FROM EASYCOM/SP_CUST');

if(is_bool($query)){

 echo "Error code: " . i5_errno() . "<br>";

 echo "Error message: " . i5_errormsg() . "<br>";

}

else {

 /* Data’s reading and displaying */

 echo "<table>";

 while ($values = i5_fetch_row($query, I5_READ_NEXT )) {

  echo "<tr>";

  echo "<td>" .$values[0]. "</td>";

  echo "<td>" .$values[1]. "</td>";

  echo "<td>" .$values[2]. "</td>";

  echo "<td>" .$values[3]. "</td>";

  echo "<td>" .$values[4]. "</td>";

  echo "<td>" .$values[5]. "</td>";

  echo "</tr>";

 }

 echo "</table>";

}

 

 

See also:

 

i5_open

i5_free_query

i5_prepare

i5_execute

i5_set_property