Jump to content

[SOLVED] compile two if statements?


s1yman

Recommended Posts

Hi,

 

I kinda cheated with this script by combining two tutorials to get it to do what I wanted. Only I've now ended up with two if/else statements at the end.

Can I merge these to just say if "all of this" rather than two seperate statements?

 

if(move_uploaded_file($_FILES['one']['tmp_name'], $target))
{
echo "The image ". basename( $_FILES['name']['type']). " has been uploaded, and your information has been added to the directory";
}
else {
echo "Sorry, there was a problem uploading your file.";
} 
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}

 

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/120238-solved-compile-two-if-statements/
Share on other sites

<?php
if(mysql_query($sql,$con)){
if(move_uploaded_file($_FILES['one']['tmp_name'], $target))
{
echo "The image ". basename( $_FILES['name']['type']). " has been uploaded, and your information has been added to the directory";
} else {
echo "Sorry, there was a problem uploading your file.";
} 
die('Error: ' . mysql_error());
}
?>

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.