Forum Moderators: coopster

Message Too Old, No Replies

Writing for PHP5

Current code does'nt work in PHP5

         

wheelie34

12:35 pm on Jan 27, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This code produces results in PHP4 but not in PHP5, what do I need to change?

$sql = "SELECT data FROM table WHERE STATUS =1";

$result = mysql_query($sql, $dblink) or die("System down");
while ($newArray = mysql_fetch_array($result))
{
$propname = $newArray['propname'];
echo "$prop<br>";
}

As I have just taken on a new server with PHP5 I have plenty of select statements like the above so am busy testing to see what needs changing, but can't even get this simple select to work, thanks in advance

wheelie34

9:23 am on Apr 15, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



My upload script is having some issues when uploading images direct from digital cameras, as they are around 1.5mb in size, it either just hangs OR doesn't create the final image, is there anything obvious

$new_pic = "$emailaddress+$key.jpg";
$new_image = "$uploaddir$new_pic";

$sourcefile = "$uploaddir$new_pic";
$picsize = getimagesize("$sourcefile");
$source_x = $picsize[0];
$source_y = $picsize[1];

if ($source_x > $source_y)
{
$percentage = ($target / $source_x);
} else {
$percentage = ($target / $source_y);
}
$dest_x = round($source_x * $percentage);
$dest_y = round($source_y * $percentage);

$targetfile = "$uploaddir".$emailaddress."-".$key.".jpg";
$jpegqual = 90;
$source_id = imagecreatefromjpeg("$sourcefile");
$target_id = imagecreatetruecolor($dest_x, $dest_y);
$target_pic = imagecopyresized($target_id,$source_id,0,0,0,0,$dest_x,$dest_y,$source_x,$source_y);
imagejpeg($target_id,"$targetfile",$jpegqual);
unlink("$new_image");

Quick legend, it creates a temp image called $emailaddress+$key.jpg
resizes, renames (replacing + with -) then deletes the temp image, sometimes the temp image isn't resized and it bombs out

jatar_k

1:17 pm on Apr 15, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



if it dies I imagine it is a size or time issue

script is timing out or you are exceeding max upload size

wheelie34

1:21 pm on Apr 15, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have root access to the server, where or what do I look for, thanks

Its a cpanel server just found this

upload_max_filesize set to 2M
max_execution_time set to 30 (seconds)

How long, in seconds is safe for the upload, I think its that thats causing the issue

coopster

12:09 pm on Apr 16, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



A 2MB file should upload fairly quickly, but that depends on the connection too. Have a look at set_time_limit [php.net] for larger uploads.
This 34 message thread spans 2 pages: 34