Posted: Wed Aug 03, 2005 5:32 am
This is where my lack of MySQL knowlege comes in (I use Postgres)
and
Code: Select all
function db_connect() {
$result = mysql_pconnect('localhost','*******','*********');
if (!result) {
echo("Connect Failed";
return false;
}
if (!mysql_select_db('xirgo_net_-_telereport')) {
echo("DB SELECT FAILED");
return false;
}
return $result;
}Code: Select all
function insert($city, $area, $street, $unit, $unitl, $incident, $property, $andiamos, $bbgs, $telxos, $observations, $ip) {
include('variables.php');
$conn = db_connect();
if ($conn) {
$result = mysql_query($conn,"INSERT INTO informes (city, area, street, unit, unitl, incident, property, andiamos, bbgs, telxos, observations, ip) VALUES ('$city', '$area', '$street', '$unit', '$unitl', '$incident', '$property', '$andiamos', '$bbgs', '$telxos', '$observations', '$ip')");
if (!mysql_affected_rows($result)) {
echo("RESULT FAILED");
return '<div class="error">No se ha podido agregar la informaci&oacture;n a la base de datos.</div>';
} else {
echo("RESULT OK");
return "";
}
} else {
echo("No DB connection !");
return '<div class="error">No se ha podido establecer una conexión a la base de datos. Por favor, inténtelo más tarde.</div>';
}
}