Converting to PostgreSQL

wxdqz

New Member
Hi,

I'm trying to port phpHoo to PostgreSQL, but cannot work out what the following functions could be. Please help!!


TIA,
Peter
==========================
function select ($sql="", $column="")
{
if(empty($sql)) { return false; }
if(!eregi("^select",$sql))
{
echo "<H2>Wrong function silly!</H2>\n";
return false;
}
if(empty($this->CONN)) { return false; }
$conn = $this->CONN;
$results = mysql_query($sql,$conn);
if( (!$results) or (empty($results)) ) {
mysql_free_result($results);
return false;
}
$count = 0;
$data = array();
while ( $row = mysql_fetch_array($results))
{
$data[$count] = $row;
$count++;
}
mysql_free_result($results);
return $data;
}

==================================
function sql_cnt_query ($sql="")
{
if(empty($sql)) { return false; }
if(empty($this->CONN)) { return false; }
$conn = $this->CONN;
$results = pg_exec($conn,$sql);
if( (!$results) or (empty($results)) ) {
pg_freeresult($results);
return false;
}
$count = 0;
$data = array();
while ( $row = pg_fetch_array($results,$results_countt++))
{
$data[$count] = $row;
$count++;
}
pg_freeresult($results);
return $data[0][0];
}
 
Back
Top