Forum Moderators: coopster

Message Too Old, No Replies

WHAT! Why no to the insert

Help !

         

diegomh7

12:24 pm on Jul 8, 2006 (gmt 0)

10+ Year Member



whats wrong here guys?

//-------------------------------------------------------------

$prod_name = $_POST["prod_name"];
echo "$prod_name<br>";
$prod_type = $_POST["prod_type"];
echo "$prod_type<br>";
$prod_code = $_POST["prod_code"];
echo "$prod_code<br>";
$brand = $_POST["brand"];
echo "$brand<br>";
$desc = $_POST["desc"];
echo "$desc<br>";
$active = $_POST["active"];
echo "$active<br>";
$offer = $_POST["offer"];
echo "$offer<br>";
$features = $_POST["features"];
echo "$features<br>";
$features2 = $_POST["features2"];
echo "$features2<br>";
$features3 = $_POST["features3"];
echo "$features3<br>";
$features4 = $_POST["features4"];
echo "$features4<br>";
$features5 = $_POST["features5"];
echo "$features5<br>";
$price = $_POST["price"];
echo "$price<br>";
$price_euros = $_POST["price_euros"];
echo "$price_euros<br>";

//-files1----------------------------------------------------------------------------------------------
move_uploaded_file($_FILES['files1']['tmp_name'],'images/products/small/'.$_FILES['files1']['name']);
$image = $_FILES['files1']['name'];
echo "$image<br>";
//-----------------------------------------------------------------------------------------------------

//-files2----------------------------------------------------------------------------------------------
move_uploaded_file($_FILES['files2']['tmp_name'],'images/products/big/'.$_FILES['files2']['name']);
$image_big = $_FILES['files2']['name'];
echo "$image_big<br>";
//-----------------------------------------------------------------------------------------------------

//-files3----------------------------------------------------------------------------------------------
move_uploaded_file($_FILES['files3']['tmp_name'],'images/products/pdf/'.$_FILES['files3']['name']);
$pdf = $_FILES['files3']['name'];
echo "$pdf<br>";
//-----------------------------------------------------------------------------------------------------

$sql = "INSERT into products (id, prod_name, prod_code, prod_type, brand, desc, image_small, image_big, active, offer, pdf, features, features2, features3, features4, features5, price, price_euros) VALUES ('', '$prod_name', '$prod_code', '$prod_type', '$brand', '$desc', 'images/products/small/$image', 'images/products/big/$image_big', '$active', '$offer', 'images/products/pdf/$pdf', '$features', '$features2', '$features3', '$features4', '$features5', '$price', '$price_euros')";
$result = mysql_query($sql) or die;

please help,

regards,

Diego

Little_G

12:31 pm on Jul 8, 2006 (gmt 0)

10+ Year Member



Hi,

Any error messages?

Andrew

dreamcatcher

12:39 pm on Jul 8, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Diego,

Try changing this line:

$result = mysql_query($sql) or die;

to:

$result = mysql_query($sql) or die(mysql_error());

See if throws out any clues.

dc

diegomh7

1:18 pm on Jul 8, 2006 (gmt 0)

10+ Year Member



You have an error in your SQL syntax near 'desc, image_small, image_big, active, offer, pdf, features, features2, features3' at line 1


its the insert script that is not working

dreamcatcher

4:15 pm on Jul 8, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



desc is a reserved word in MySQL. You cannot have a table row named this. You need to change it to something else.

For more info see:
[dev.mysql.com...]

dc

diegomh7

5:10 pm on Jul 8, 2006 (gmt 0)

10+ Year Member



thanx dreamcatcher, ive heard that before think its just force of habbit, but anyway ive used it before and its never interfiered, is that the only thing thats wrong though? if it a string it wont matter anyway will it?

thanx

diegomh7

5:17 pm on Jul 8, 2006 (gmt 0)

10+ Year Member



changed the column name and script and stil no joy, ive only got until tuesday to get this working,

any more ideas guys,

Diego

jatar_k

7:07 pm on Jul 8, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



does it still give you the same error from mysql once the column name is changed?

diegomh7

9:08 am on Jul 10, 2006 (gmt 0)

10+ Year Member



Yeah im still getting the same error, i just cant see whats wrong,

ill show you the code as it stands now, the problem is in the insert script,

regards,

Diego

<?php

$sql = "INSERT into products (id, prod_name, prod_code, prod_type, brand, describe, image_small, image_big, active, offer, pdf, features, features2, features3, features4, features5, price, price_euros) VALUES ('', '$prod_name', '$prod_code', '$prod_type', '$brand', '$describe', 'images/products/small/$image', 'images/products/big/$image_big', '$active', '$offer', 'images/products/pdf/$pdf', '$features', '$features2', '$features3', '$features4', '$features5', '$price', '$price_euros')";
$result = mysql_query($sql) or die(mysql_error());

?>

help :)

dreamcatcher

9:21 am on Jul 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



diegomh7,

Can you post the new error for us please?

dc

diegomh7

9:54 am on Jul 10, 2006 (gmt 0)

10+ Year Member



You have an error in your SQL syntax near 'describe, image_small, image_big, active, offer, pdf, features, features2, featu' at line 1

not very helpful is it,

Diego

Sekka

10:12 am on Jul 10, 2006 (gmt 0)

10+ Year Member



'describe' is also a reserved word.

See this list [dev.mysql.com...]

Use 'descrip' or 'description'.

diegomh7

11:12 am on Jul 10, 2006 (gmt 0)

10+ Year Member



I Love you!