![]() |
whats wrong with these scripts i made?????
first of all i have this number guessing game i made and this is the code i have:
PHP Code:
Code:
Parse error: parse error in /mnt/host-users/homeworkhh/guess.php on line 11 i can't find any errors..... and my second problem is on my upload script, my code is: PHP Code:
and the server gives me this error (when all variables are filled in): Code:
Parse error: parse error in /mnt/host-users/homeworkhh/mtuploader.php on line 6 |
1- Missing " at the end of line:
$message="$guess is too low, try a higher number:; should be: $message="$guess is too low, try a higher number:"; 2- Unnecessary space at: $file_ url= "http://www.yoursite.com/uploads"; Should be: $file_url= "http://www.yoursite.com/uploads"; ;) |
ok thx for #1 that worked (jus a typo, typed it up quickly) but i did what u say on #2 but it say this error:
Code:
Parse error: parse error, expecting `']'' in /mnt/host-users/homeworkhh/mtuploader.php on line 11 what might it be???? |
$file_array['tmp_name;]
is wrong. Should be: $file_array['tmp_name']; These are very easy to catch syntax errors. Please check your code carefully, I'm sure you can easily correct them.. Regards, Logician |
ok thx ;) i typed 1 up quickly and one late at night so i wouldnt know, and i aint that good wif PHP and they r my first scripts so i wouldnt know where to look for errors :(.....BTW i jus did what u say and i get this error:
Code:
Parse error: parse error in /mnt/host-users/homeworkhh/mtuploader.php on line 11 PLZ help........... |
file_array['type'] == "image/gif'
is wrong. Should be: file_array['type'] == "image/gif" You better use this code below. I edited all your syntax errors so you wouldnt get any parse errors with this one. (However this only applies to syntax errors, I cant say anything with your coding algorithm. And may I suggest you begining PHP from the begining with learning the basics first? You are going too fast to write this script if you really dont know how to correct these simple errors. My 2 cents.. -- cut --- $file_dir= "/path/to/fokder/uploads"; $file_url= "http://www.yoursite.com/uploads"; foreach( $HTTP_POST_FILES as $file_name => $file_array ) { print "path: ".$file_array['tmp_name']."<BR>\n"; print "name: ".$file_array['name']."<BR>\n"; print "type: ".$file_array['type']."<BR>\n"; print "size: ".$file_array['size']."<BR>\n"; $filename=(string)$file_array['tmp_name']; $filetype=(string) $file_array['type']; if (is_uploaded_file($filename) AND $filetype=="image/gif" ) { $log_v1=$file_array['tmp_name']; //$log_v2=$file_dir."/".$file_name; move_uploaded_file($log_v1, $log_v2) or die ("Couldn't copy"); print "<IMG src='\"$file_url/$file_name\"'><P>\n\n"; } } -- cut --- |
that dont work....neither of them :(
|
pattox2k1, the code I posted is free of syntax errors, you wouldnt get any parse errors or anything with that code.
But as I said, I dont know if it works as it should be or not, because I am not aware of what you are trying to do with this script. You asked the correction of the errors you get and I fixed them. If your algorithm is wrong, the code might not do what you are aiming to do, even if it gives no errors.. |
ok then i will try and type it up again and see what happens........if it dont work i will ask someone else for help ;)
|
All times are GMT. The time now is 07:00 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|