PHP Classes

$x->query($sql)

Recommend this page to a friend!

      Forums Integrator  >  All threads  >  $x->query($sql)  >  (Un) Subscribe thread alerts  
Subject:$x->query($sql)
Summary:Tutorial Request:
Messages:3
Author:jim le
Date:2006-09-06 18:04:54
Update:2006-09-07 17:47:30
 

  1. $x->query($sql)   Reply   Report abuse  
Picture of jim le jim le - 2006-09-06 18:04:54
Hello.
I found your forum integrator very useful.
I have little experience with php and mysql, so I was wondering if it would be okay for you to write up a quick example of how I would use this function ($x->query($sql)).

Many thanks in advance.

  2. Re: $x->query($sql)   Reply   Report abuse  
Picture of Piotr Malinski Piotr Malinski - 2006-09-07 15:40:47 - In reply to message 1 from jim le
$x->query("SQL CODE HERE") will execute the SQL Query. If it is a SELECT it will return an array with results (array of associative arrays)

$x->query("DELETE FROM mytable");

$query = $x->query("SELECT FROM mytable");
if(is_array($query[0]))
{
foreach($query as $res)
{
print $res['columnName'];
}
}

  3. Re: $x->query($sql)   Reply   Report abuse  
Picture of jim le jim le - 2006-09-07 17:47:30 - In reply to message 2 from Piotr Malinski
Thank you.