0

I get the following error:

ERROR: relation "public.test" does not exist LINE 1: INSERT INTO public.Test(data33) VALUES('aabbcc') ^

This is my code:

    <?php
include("connect.php");

date_default_timezone_set('America/Mexico_City');

// Then call the date functions
$date = date('Y-m-d H:i:s');



$query = "INSERT INTO public.Test(data33) VALUES('aabbcc')";

//$result = pg_query_params ( $db_conn,$query);


if (!pg_connection_busy($db_conn)) {
    pg_send_query($db_conn, $query);
}

$res1 = pg_get_result($db_conn);
echo pg_result_error($res1);

pg_close($db_conn);
?>

Anyone know which is the problem?

  • `relation "public.test" does not exist` sounds like a problem with your database. If the error message is the same when running the query using a pure database connector, this is unrelated to PHP – Nico Haase Jul 16 '22 at 08:56
  • Sounds like you’re not connected to the db you think you are, or the table simply doesn’t exist. Try e.g. https://stackoverflow.com/q/14730228/761202 – AD7six Jul 16 '22 at 09:08
  • I don't get error when I use de database connector: INSERT INTO public."Test"(data33) VALUES('aabbcc'); – Ruben Ochoa Jul 16 '22 at 09:37
  • Could you try to run the **exact same** query in your database connector? – Nico Haase Jul 16 '22 at 12:02

0 Answers0