English 中文(简体)
PHP PostgreSQL pg_exec don t work
原标题:PHP PostgreSQL pg_exec doesn t work

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());
问题回答

U能够以这种方式执行pg_execute()

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

它将肯定地工作......并且请将你的全部守则张贴在后面,以便我能够清楚地解释你。

我不知道PHP,但我看到在Kall使用两个问题。

  • 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)





相关问题
摘录数据

我如何将Excel板的数据输入我的Django应用? I m将PosgreSQL数据库作为数据库。

Postgres dump of only parts of tables for a dev snapshot

On production our database is a few hundred gigabytes in size. For development and testing, we need to create snapshots of this database that are functionally equivalent, but which are only 10 or 20 ...

How to join attributes in sql select statement?

I want to join few attributes in select statement as one for example select id, (name + + surname + + age) as info from users this doesn t work, how to do it? I m using postgreSQL.

What text encoding to use?

I need to setup my PostgreSQL DB s text encoding to handle non-American English characters that you d find showing up in languages such as German, Spanish, and French. What character encoding should ...

SQL LIKE condition to check for integer?

I am using a set of SQL LIKE conditions to go through the alphabet and list all items beginning with the appropriate letter, e.g. to get all books where the title starts with the letter "A": SELECT * ...

热门标签