update statement trouble

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
Love_Daddy
Forum Commoner
Posts: 61
Joined: Wed Jul 10, 2002 6:55 am
Location: South Africa
Contact:

update statement trouble

Post by Love_Daddy »

Hi Guys, me again...

I have a problem with a update statement I'm writing..

$SQL = "update <table> SET
days = $days and used_days = $used
WHERE emp_no = $emp_no"

given that all the variables are numerics

so I get the following error:


Warning: PostgreSQL query failed: ERROR: parser: parse error at or near "" in
/var/www/html/Voffice/process.php on line 17
Connection to Table not established!

whereby line 17 is:
$results=pg_exec($conn,$sql);
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Have you tried echoing your SQL statement to make sure that all the variables are getting passed to it properly?

(Oh and database questions belong in the database forum)

Mac
User avatar
Love_Daddy
Forum Commoner
Posts: 61
Joined: Wed Jul 10, 2002 6:55 am
Location: South Africa
Contact:

Post by Love_Daddy »

Ooops my bad...
I'll remember next time.
Yes, I've echoed my sql and since the values I'm supposed to pass to the database
are coming from another page, so I get the following:
and remember this is the echoed stmnt
UPDATE leave SET leave_days = 0,used_days = 0 WHERE emp_no =
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

It's probably just a typo but is there no value for $emp_no?

Mac
User avatar
Love_Daddy
Forum Commoner
Posts: 61
Joined: Wed Jul 10, 2002 6:55 am
Location: South Africa
Contact:

Post by Love_Daddy »

You are right,
The only problem was not the script but the values that I ommitted.

Thanks it's working now..
:P
Post Reply