0

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...

3
Contributors
4
Replies
6
Views
7 Years
Discussion Span
Last Post by phpbeginners
0

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.

0

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

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

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

}
that condition trace the empty value of that field.
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.