i want to insert non empt values (as $im1, $im2.....) in mysql database, code is as follow, im_id is auto_increment key

$im1 =image1['image'];
$im2 =image2['image'];
$im3 =image3['image'];
$im4 =image4['image'];
  	
$sql = "INSERT INTO `class-ads`.`images` 
	   (im_id, image) 
   VALUES (NULL, '$im1'), 
	   (NULL, '$im2'),
	   (NULL, '$im3'),
               (NULL, '$im4') 
mysql_query($sql) or die('Error, Posting Image failed : ' . mysql_error());

any help plz...

i want to insert non empt values (as $im1, $im2.....) in mysql database, code is as follow, im_id is auto_increment key

$im1 =image1['image'];
$im2 =image2['image'];
$im3 =image3['image'];
$im4 =image4['image'];
  	
$sql = "INSERT INTO `class-ads`.`images` 
	   (im_id, image) 
   VALUES (NULL, '$im1'), 
	   (NULL, '$im2'),
	   (NULL, '$im3'),
               (NULL, '$im4') 
mysql_query($sql) or die('Error, Posting Image failed : ' . mysql_error());

any help plz...

Before sending the data to query, you can filter it and fire the query with proper data.

modify you database structure change it to NULL instead of NOT NULL that field.

but i could not figure out any filter for sorting empty variables..

use this for every field
$subuser = $POST['FIELD'];

     if(!$subuser || strlen($subuser = trim($subuser)) == 0){

}
that condition trace the empty value of that field.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.