![]() |
Hi,
I have 2 questions: Firstly, I have the following function, but it doesnt work Sad :
function insert($school_id, $email, $text, $pic) {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 ]) |
I can't help you with the picture uploading but I can tell say you are trying run an query without ever connecting to the databse :P.
Before you run the query you need to have :
$dbconnect = mysql_connect('localhost', 'root', 'mypassword');And when your run your query you need to include the vaible that has your connection info :
$result = mysql_query($command,$dbconnect);And as a good habit after you run your query you want to close the connection to the database. :
mysql_close($dbconnect);I can't help you with mysql_result because I've never used it before and I can't figure what your trying to do with it. |
I think you need to mysql_fetch_array($result)
|
No, he doesnt need mysql_fetch_array or mysq_fetch_assoc but he can make it easier on himself by using it...
|
mysql_result is perfectly acceptable. Whenever you get an error such as that it means that your query was rejected by the server. You need to debug and figure out why, I would suggest using print_r( $query_handle ) or mysql_error( ) for more information.
In this case it looks to simply be that you forgot to connect to the database server. mysql_connect() is what you want for that. |
| All times are GMT -5. The time now is 6:34 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC