![]() |
|
#1
|
|||
|
|||
Image uploaderHello everyone I have a problem with my upload when uploading I get this this message.
File has been uploadet: tastetur.jpg You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(billede,tekst) VALUES='tastetur.jpg','jjkk'' at line 1 My code looks like this PHP Code:
I really hope that there is one who can tell me what goes wrong. Thank you in advance dinno Last edited by LuciWiz : 20-Aug-2009 at 09:18.
Reason: Please insert your Php code between [php] & [/php] tags
|
|||
|
#2
|
||||
|
||||
Re: image uploaderYou have crossed the syntax of an INSERT statement with part of an UPDATE statement, but you are close...
The generic form for an INSERT or UPDATE is: Code:
So, in your SQL, the 'SET' needs removal: PHP Code:
For an INSERT should be formed like so: PHP Code:
__________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#3
|
|||
|
|||
Re: image uploaderhey 1000 thanks, it works almost as it should, the upload the image to a folder and text from the entry fields in to the database but does not takes
the filename to the database ... how can it be? dinno |
|
#4
|
||||
|
||||
Re: image uploaderGood.
Sorry that I forgot to mention to also remove the = with the VALUES, but I had it correct in the example. Anyway, echo the query string for output and make sure it looks like what is expected. Maybe the value is blank? __________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#5
|
|||
|
|||
Re: image uploaderHello again have the right value was empty I did like this now and it works thanks smile again it looks like this now ...
<?php if (isset($_FILES['filnavn'])) {print "Fil der er blevet overført: {$_FILES['filnavn']['name']}<p>\n"; $tekst=$_POST['tekst']; $webadr=$_POST['webadresse']; $userid=$_POST['userid']; $filnavn=$_FILES['filnavn']['name']; $query = "INSERT INTO dagenstilbud (billede, tekst, webadresse, mainid) VALUES ('$filnavn','$tekst','$webadr','$userid')"; $Result1 = mysql_query($query, $cms) or die(mysql_error()); } { $tempfile = $_FILES['filnavn']['tmp_name']; $destination = "dagenstilbud/{$_FILES['filnavn']['name']}"; copy($tempfile, $destination); } ?> |
Recent GIDBlog
Programming ebook direct download available by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Image onto JFrame | tedds | Java Forum | 8 | 25-Oct-2007 21:04 |
| Importing images | arety33 | Java Forum | 1 | 12-Jul-2007 14:28 |
| draw in image | jafar | FLTK Forum | 2 | 19-Sep-2006 11:51 |
| GIM gidedit - a fltk fluid resize project | cable_guy_67 | FLTK Forum | 2 | 01-Jun-2005 16:00 |
| Checking source codes of image, audio and video files | onauc | C Programming Language | 5 | 26-Feb-2005 22:47 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The