0

Hey, can someone tell me why my php doesen't execute the SQL Code in PGSQL.. The connection is working fine, i send query's with p_send_query but pg_execute doesen't work ..

   pg_send_query($PG_Con, 
      "INSERT into 'frontend_usermessage' 
              (opened, created, text, to_user_id, 
               from_user_id, administrative, subject) 
       VALUES ('NULL','$created','$text','$to_user',
               '$cookie','$admin','$fromuserr')") 
       or die(pg_error());

    $credits_new = $credits - 1;
    pg_send_query($PG_Con, "UPDATE users_mfuser SET song_credits='$credits_new' 
                     WHERE user_ptr_id='$cookie'") or die(pg_error());
3
  • 1
    People are really not interested in asking question they are just interested in posting questions Commented Feb 5, 2011 at 8:05
  • 1
    Where are you calling pg_execute? What doesn't work, are you getting errors? If so, please post them. Commented Feb 5, 2011 at 8:11
  • This is the problem, i try with pg_execute, pg_exec, pg_send_exec .. but nothing from this tree doesen't work.. Php don't send the information to PSQL with this tree commands. How to fix this functions .. Commented Feb 5, 2011 at 8:14

2 Answers 2

1

U can use in this way for executing pg_execute(),

$Query = pg_query("your query here....").
pg_execute($Query);

it will work definitely..... and also please post your entire code so that i can explain you clearly..

Sign up to request clarification or add additional context in comments.

Comments

0

I don't know PHP but I see two problems int the SQL that you use

  • The syntax INSERT INTO 'frontend_usermessage' is wrong. A table name may not be enclosed in single quotes
  • 'NULL' will insert the character string NULL into that column, *no*t a NULL value. If opened is not a varchar/text column, this will throw an error (unless there is some magic processing going on in PHP, that turns the string 'NULL' into a null value)

But you need to explain precisely what doesen't work means.
doesen't work is not a valid Postgres error (and most probably not a valid PHP error either)

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.