Hi Guys,
I'm currently developing a small Mysql wrapper and I'd like to ask you for a little help.
How would you improve this method?:
<?php
public function sendQuery($Statement=NULL, $Variables=array())
{
if($Statement!=NULL)
{
if($Variables!=NULL)
{
$Vars = NULL;
if(is_array($Variables) && count($Variables)>0)
{
foreach($Variables as $key => $value)
{
$Vars .= ',\''.$this->escapeString($value).'\'';
}
}
$Statement = '$query = sprintf("'.$Statement.'"'.$Vars.');';
eval($Statement);
$query = mysql_query($query, $this->LinkID);
if($query)
{
$this->Query = $query;
}
else
{
$this->errorSET('Query could not be executed', true);
}
}
else
{
$query = mysql_query($Statement, $this->LinkID);
if($query)
{
$this->Query = $query;
}
else
{
$this->errorSET('Query could not be executed', true);
}
}
return $this->Query;
}
return false;
}
?>
So long,
JaZz