View Full Version : FORM - send image in different table then datas

05-17-2008, 10:40 PM
There are actually TWO INSERT commands. I would need to put them IN ONE INSERT.
But how?

// ------ FIRST INSERT

if ($action=="adsadd")
if ($_POST['MAX_FILE_SIZE'] >= $_FILES['file']['size']) {
mysql_connect("localhost", "user", "password") or die(mysql_error());
$photo = addslashes(fread(fopen($_FILES['file']['tmp_name'], "r"), $_FILES['file']['size']));
$query = sprintf("INSERT INTO classified(Image, FileType) VALUES
('%s', '%s')", $photo, $_FILES['file']['type']);
if (mysql_query($query)) {
$messages[] = "Your files is successfully store in database";
} else {
$messages[]= mysql_error();
} else {
$messages[]="The file is bigger than the allowed size please resize";

if (isset($messages)) {
foreach ($messages as $message) {
print $message ."<br>";

$link_name = strip_tags($link_name);
$link_desc = strip_tags($link_desc);
$price = strip_tags($price);
$personal_name = strip_tags($personal_name);
$address = strip_tags($address);
$telephone = strip_tags($telephone);
$city = strip_tags($city);
$web_page = strip_tags($web_page);
$picture = strip_tags($picture);


// -------- SECOND INSERT

$rime1 = "INSERT into classified VALUES ('NULL','$cat_id','$link_name','$link_desc','$price','$personal_name','$address','$telephone',
'$result_email','$country','$state','$city','$today','$expires','$web_page','$picture','yes','$resul t_gold','0')";
$result = mysql_query($rime1);

05-19-2008, 02:43 PM
why nobody answers me? oh <? echo "pour me....";?>

05-19-2008, 03:47 PM
um... put the 2nd query before the exit inside the if condition? That code is near unreadable by the way...

05-19-2008, 06:01 PM
I checked the full code and the } are not wrong. There is not syntax error. (I just made a copy and paste cancelling some LOONG and unimportant code).
Could you please make one unique INSERT code from the two INSERTS that I got in the beginning code?:)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum