Forums

PHP

This topic is locked

PHP Upload script problem (not the usual one!)

Posted 06 Jun 2002 15:20:49
1
has voted
06 Jun 2002 15:20:49 Julio Taylor posted:
Hey

i have a page which updates a record and uploads an image.... everything is fine but i get SQL errors when i have BOTH the upload script and the $HTTP_GET_VARS variable filtering on the page. Remove one or the other and all is fine. Any ideas? I couldn't really find anything else on this so i thought i would try here.

error is "You have an error in your SQL syntax near '' at line 1"

Replies

Replied 06 Jun 2002 17:03:29
06 Jun 2002 17:03:29 Aurel Sorin Cirstoiu replied:
Please give me more details about this. And also in you can print the sql generated(use echo ... ) and put let me see it.

-----------------------
Cirstoiu Aurel Sorin
InterAKT Support
www.interakt.ro
Replied 06 Jun 2002 17:14:20
06 Jun 2002 17:14:20 Julio Taylor replied:
Hi,

Ok, i'm filtering a form down to one record, passing the GET variable "job_id". It should return only one record(the one that matches the job_id number that is passed). This is pretty standard stuff and it works fine all the time. In either case, here's the SQL code i'm using.

SELECT job_id, concat(job_code,'/',job_id) as job_numbet_concat, CONCAT(com_name,' »') as com_name, CONCAT(dayofmonth(job_rec_date),'/',month(job_rec_date),'/',year(job_rec_date)) as job_date_concat, job_ord_file, CONCAT('£',job_value) AS job_value, job_notes, CONCAT(DAYOFMONTH(job_sys_date_enter),'/',MONTH(job_sys_date_enter),'/',YEAR(job_sys_date_enter),' by ',job_sys_author) as sys_info
FROM job_master, job_types, com_master
WHERE job_master.job_type_id = job_types.job_type_id AND job_id= MMColParam

where MMColParam = $HTTP_GET_VARS["job_id"], a numerical value.

This works fine all the time, until i try it alongside the PHP UPload Script from Tim Green. When the script is implemented (i did it using the instructions supplied with the extension, where you put the Upload Script first, then the Recordset then the Update Bahviour) it stops working and i get an SQL error message. ("You have an error in your SQL syntax near '' at line 1".

My main source of confusion is that the SQL code works fine when it is used by itself (e.g. separate from the upload script). They don't *have* to be together, but i can't think of any other way of appending an image to a record without doing this.

Thanks a lot for your help. Let me know if there's any other stuff you'd like to see. How do i print the SQL generated?

Thanks!
Replied 06 Jun 2002 19:53:36
06 Jun 2002 19:53:36 Tim Green replied:
OK, I'm a little confused here. The problems you are experiencing are down to the combination of an Update Record behavior, and the PHP Upload behavior, and yet the SQL you've posted is from a Recordset.

Are you using a recordset too?


Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Replied 07 Jun 2002 09:17:31
07 Jun 2002 09:17:31 Julio Taylor replied:
Yes, sorry!

I's using a recordset alongside my Update function, which is what seems to cause the problem. So yes, in the page i have (in order of placement)

1. Upload behaviour
2. Recordset
3. PHP Upload Behaviour

It works fine until i apply the upload behaviour, at which point it doesn't even load the page, gives me an SQL error.

This is the line in the PHP code where it calls the SQL code:

&lt;?php
$ack_confirm=$ims_php-&gt;Execute("SELECT * FROM job_master WHERE job_id = " . ($ack_confirm__MMColParam) . "" or DIE($ims_php-&gt;ErrorMsg());
$ack_confirm_numRows=0;
$ack_confirm__totalRows=$ack_confirm-&gt;RecordCount();
?&gt;

If i replace the variable '$ack_confirm_MMColParam' (which is meant to be the GET variable from the URL) with a value (e.g. '18'), it works fine, so it seems to be a problem with the page processing the variables *and* the upload script.

btw, i'm using Win2k/IIS, in case that makes a difference.

Thanks a lot for your help....

Edited by - poolio on 07 Jun 2002 09:47:18

Reply to this topic