Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Nov 7th, 2004, 11:00 AM   #1
nickk
Newbie
 
Join Date: Oct 2004
Posts: 4
Rep Power: 0 nickk is on a distinguished road
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

(added a little code formatting, courtesy of your friendly neighborhood Spider Man .. [ AKA: SykkN ])
nickk is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:02 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC