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?

4
  • 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 Commented Jul 16, 2022 at 8:56
  • Sounds like you’re not connected to the db you think you are, or the table simply doesn’t exist. Try e.g. stackoverflow.com/q/14730228/761202 Commented Jul 16, 2022 at 9:08
  • I don't get error when I use de database connector: INSERT INTO public."Test"(data33) VALUES('aabbcc'); Commented Jul 16, 2022 at 9:37
  • Could you try to run the exact same query in your database connector? Commented Jul 16, 2022 at 12:02

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.