The following worked for me. I had to put the $connection in or it wouldn't work. Please keep in mind that I am still a newbe to this and my scripts are very basic but they do work in the end 😉 Good luck!
<?
$connection = mysql_connect("localhost", "name", "passwd")
or die ("Couldn't connect to server.");
$db = mysql_select_db("databasename", $connection)
or die ("Couldn't select database.");
Header("Content-Type: image/jpeg");
$sql = "SELECT * FROM dbfield WHERE id = '$id'";
$sql_result = mysql_query($sql,$connection)
or die("Couldn't execute query.");
$list = mysql_fetch_array($sql_result);
$filename = $list["filename"];
$src_img = imagecreatefromjpeg("../path/folder/$filename");
$new_w = 175;
$new_h = imagesy($src_img) / ( imagesx($src_img) / $new_w );
$dst_img = imagecreate($new_w,$new_h);
imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img));
imagejpeg($dst_img, '', 65);
?>