php - completely run in localhost but not in live server in postgreSQL -
my code these.
$host = "host=localhost"; $port = "port=5432"; $dbname = "dbname=test_db"; $credentials = "user=postgres password="; $db = pg_connect( "$host $port $dbname $credentials" ); $query = "insert table_test_som(uid, book_status, book_datetime, dom_id, from_date, to_date, from_time , to_time, event) values ('4', '1', '2016-07-19 12:29:42', '27', '2016-07-22', '2016-07-22', '11:30', '12:00', 'booking_vijay')"; $result = pg_query($query); if (!$result) { $errormessage = pg_last_error(); echo "error query: " . $errormessage; exit(); } printf ("these values inserted database"); pg_close();
in localhost code run completely, when execute in server display error :
error query: error: permission denied sequence table_test_som
this should not happen postgres user. betting have changed code when tried on live server.
$credentials = "user=postgres password=";
the actual user not have privileges sequences. can fix
grant usage, select on sequences in schema public my_user;
taking care replace my_user actual username using in php code.
if doesn't work you, option execute query on each table causes trouble.
Comments
Post a Comment