Hi,
I have 2 questions:
Firstly, I have the following function, but it doesnt work Sad
function insert($school_id, $email, $text, $pic) {
$sql = "select class, first_name, second_name from yearbook where school_id = '$school_id'";
$result = mysql_query($sql);
$class = mysql_result($result, 1, "class");
$first_name = mysql_result($result, 1, "first_name");
$last_name = mysql_result($result, 1, "last_name");
$pic = "../" . $class . "/" . $first_name . "-" . $last_name . ".jpg";
$sql = "update yearbook set email = '$email', text = '$text', pic = '$pic' where school_id = '$school_id'";
if(mysql_query($sql)) {
echo "<b>Text and picture sucessfully uploaded!</b>\n";
return 1;
} else {
echo "<b>Error submitting text and picture to the database, go back and try again</b>\n";
return 0;
}
} //end function insert
It gives me the following errors:
Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /usr/home/nickk/public_html/yearbook/provide/upload.php on line 228
Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /usr/home/nickk/public_html/yearbook/provide/upload.php on line 229
Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /usr/home/nickk/public_html/yearbook/provide/upload.php on line 230
and it doesnt add the proper values for "pic" to the database Sad
Secondly, I'm having problems uploading files (pictures to be exact) with PHP. Does anyone know how this is done?
Thanks, Nick