Jump to content

First value of Array


NONAME_2

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.