NONAME_2 Posted February 8, 2011 Share Posted February 8, 2011 Hi all, i want upload 3 images .they upload in definded path complete but my first value in array newsimg[0] in insert, is empty: my code: $query = "INSERT INTO news SET postdate=NOW(),". "ttl='$title', newstxt='$description', ". "isprv='$isprv',authr='$login' "; if (isset($newsimg[0])) $query .=",newsimg1='$newsimg[0]'" ; if (isset($newsimg[1])) $query .=",newsimg2='$newsimg[1]'" ; if (isset($newsimg[2])) $query .=",newsimg3='$newsimg[2]'" ; if (mysql_query($query)) { echo "<pre>"; print_r($newsimg); echo "</pre>"; } Sample Result: Array ( [] => 1297148403tulips 04.jpg [1] => 1297148404tulips 03.jpg [2] => 1297148405tulips 02.jpg ) Can i use `0` instead of 0 for my value('s) array. TNX. Link to comment https://forums.phpfreaks.com/topic/227032-first-value-of-array/ Share on other sites More sharing options...
NONAME_2 Posted February 8, 2011 Author Share Posted February 8, 2011 Can i use `0` instead of 0 for my value('s) array. it isn't a good idea , any answer freinds? Link to comment https://forums.phpfreaks.com/topic/227032-first-value-of-array/#findComment-1171378 Share on other sites More sharing options...
BlueSkyIS Posted February 8, 2011 Share Posted February 8, 2011 how are you adding items to $newsimg? Link to comment https://forums.phpfreaks.com/topic/227032-first-value-of-array/#findComment-1171422 Share on other sites More sharing options...
NONAME_2 Posted February 9, 2011 Author Share Posted February 9, 2011 how are you adding items to $newsimg? Thank you blueskyIS, my solution was in var like $ctr that not initialized.TNX. Link to comment https://forums.phpfreaks.com/topic/227032-first-value-of-array/#findComment-1171668 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.