Re: Odd "INSERT" Problems with PostgreSQL - Do YOU know?
От | Richard Huxton |
---|---|
Тема | Re: Odd "INSERT" Problems with PostgreSQL - Do YOU know? |
Дата | |
Msg-id | 006501c0e439$4ad33b80$1001a8c0@archonet.com обсуждение исходный текст |
Ответ на | Re: Odd "INSERT" Problems with PostgreSQL - Do YOU know? (Diana Cionoiu <diana@softwaresolutions.ro>) |
Список | pgsql-general |
From: "Diana Cionoiu" <diana@softwaresolutions.ro> > >Here's my sql statement: > >$sql = "insert into pricing (prod_id, size_id, price) values ($prod_id, > >$size_id, 0.00)"; > > > >here's an example of what it generates before it inserts: > >insert into pricing (prod_id, size_id, price) values (148, 48, 0.00) > > The problem is from php, please do this > print $prod_id; > and see what it give you > in php you must have someting like. > $mumu = pg_exec ($conn, "insert into mumulica (mumu1,mumu2) values('" . > $mumu1 . "','" . $mumu2 . "')"); Absolutely correct for strings, although in your example you could use: pg_exec($conn, "insert into mumulica (mumu1,mumu2) values ('$mumu1','$mumu2')") bearing in mind the need to escape ' marks. But - Jason's using numbers so he should be fine. Jason - sounds like you're checking return values, so we can be reasonably sure the insert occurred. You're not inside a transaction block that gets rolled back are you? Might be scripts failing half-way through because of connection problems too. I'd be tempted to print $sql to a log-file so you can see what you think you inserted and compare it to Postgres. You can also turn the logging level up in PG to see individual queries, but that can be a little overwhelming. - Richard Huxton
В списке pgsql-general по дате отправления: