I am trying to get to download images into a file from database field urls onto my server as there is lots of them. I think im on the right track.

I currently have an error

Parse error: syntax error, unexpected T_STRING in getimages.php on line 11

Hope someone can help with this please.

mysql_connect("localhost", "X", "X") or die(mysql_error());
mysql_select_db("X") or die(mysql_error());

$query = "SELECT * FROM TABLE";

$result = mysql_query($query) or die(mysql_error());
while($file = mysql_fetch_array($result))

$image = file_get_contents(' . $file[' . image . ']. ');

$path = 'images/' . $file[' . image . '] . ';
file_put_contents($path, $image);


Recommended Answers

Line 11:

$image = file_get_contents($file['image']);

Line 16:

$path = 'images/' . $file['image'];
Jump to Post

All 2 Replies

Line 11:

$image = file_get_contents($file['image']);

Line 16:

$path = 'images/' . $file['image'];

Brilliant works perfect, thanks for your help

Be a part of the DaniWeb community

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