Forums
This topic is locked
Insert new record script failing after PHP Upload
Posted 06 Feb 2002 11:07:51
1
has voted
06 Feb 2002 11:07:51 Stephen Bateman posted:
I am using the PHP Upload fine, and was using the Macromedia insert to add the record to the database. But with over 5000 images now I wanted to change the structure of instead of all files going into one folder we has a folder for each member. Changing the PHP Upload was no problems, but the insert record is driving me mad. If anyone can help me spot my mistakes I would appreciate it.
if (isset($MM_insert)){
require_once("/home/sites/site15/web/adodb/adodb.inc.php"
require_once("/home/sites/site15/web/Connections/conn_nangels.php"
require_once(ADODB_DIR."/KTeditOps_declareVars.php"
$rs_photos = $conn_nangels->Execute("SELECT * FROM photos" or KT_DIE($conn_nangels->ErrorNo(),$conn_nangels->ErrorMsg());
$rs_photos_numRows=0;
$rs_photos__totalRows=$rs_photos->RecordCount();
$form_member_id = $HTTP_POST_VARS["member_id"];
$form_url = "/";
$form_url .= $HTTP_POST_VARS["member_id"];
$form_url .= "/";
$form_url .= $HTTP_POST_VARS["url"];
$form_height = $HTTP_POST_VARS["height"];
$form_width = $HTTP_POST_VARS["width"];
$form_imagedate = $HTTP_POST_VARS["imagedate"];
$form_firstlook = $HTTP_POST_VARS["firstlook"];
$form_status = $HTTP_POST_VARS["status"];
$form_dtstamp = "";
$insquery = "insert into photos values (NULL, '".$form_member_id."', '".$form_url."', '".$form_height."', '".$form_width."', '".$form_imagedate."', '".$form_firstlook."', '".$form_status."', NULL)";
$photos=$conn_nangels->Execute($insquery) or KT_DIE($conn_nangels->ErrorNo(),$conn_nangels->ErrorMsg());
$rs_photos->Close();
}
All I get is :
An error occured!
Error no: 1064
Error message: You have an error in your SQL syntax near '() values ()' at line 1
Replies
Replied 06 Feb 2002 23:35:02
06 Feb 2002 23:35:02 Tim Green replied:
The problem is because you are not saying which columns are going to receive the data. Hence the cryptic error...
When using the VALUES keyword you need to use a syntax like this:-
INSERT INTO table (col1,col2,col3,col4) VALUES ('val1','val2','val3','val4')
It would also have been helpful if you had mentioned that you were using ImpAKT! <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle> But that's OK, it didn't matter in this instance <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Anyway, I hope this helps.
All the best
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>
When using the VALUES keyword you need to use a syntax like this:-
INSERT INTO table (col1,col2,col3,col4) VALUES ('val1','val2','val3','val4')
It would also have been helpful if you had mentioned that you were using ImpAKT! <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle> But that's OK, it didn't matter in this instance <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Anyway, I hope this helps.
All the best
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>