benjy355 Posted August 3, 2006 Share Posted August 3, 2006 A query I'm using is returning no errors and no database update! $qtxt = "INSERT INTO site_uploads (uid, title, desc, file, uploaded) VALUES ('" . $UserID . "', '" . $Data[1] . "', '" . $Data[2] . "', '" . $_FILES['uploaded']['name'] . "', '" . date("Y-m-d") . "')";mysql_query($qtxt) or CreateError("Could not query database: " . mysql_error()); Anybody know why this is happening? After I printed the query this was basically what came up: (no errors I can see) INSERT INTO site_uploads (uid, title, desc, file, uploaded) VALUES ('1', 'Notepad 2', 'Try it!', 'Notepad 2.zip', '2006-08-03') Link to comment Share on other sites More sharing options...
aspnetguy Posted August 3, 2006 Share Posted August 3, 2006 are all sql fields of type text or varchar???I don't see anything wrong either Link to comment Share on other sites More sharing options...
justsomeguy Posted August 3, 2006 Share Posted August 3, 2006 What does CreateError do? Maybe just print mysql_error() regardless of what happens, and see if it ever shows anything. Link to comment Share on other sites More sharing options...
benjy355 Posted August 3, 2006 Author Share Posted August 3, 2006 What does CreateError do? Maybe just print mysql_error() regardless of what happens, and see if it ever shows anything.CreateError(); is a function I made for posting errors without stopping everything and ruining the page >_>The database structure is: (phpMyAdmin ftw!) Link to comment Share on other sites More sharing options...
justsomeguy Posted August 3, 2006 Share Posted August 3, 2006 Try pasting the generated query directly into phpMyAdmin and see if it works then. Link to comment Share on other sites More sharing options...
benjy355 Posted August 3, 2006 Author Share Posted August 3, 2006 Mmkay... MySQL said:#1064 - 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 'desc, file, uploaded) VALUES ('1', 'Notepad 2', 'It rocks your s Link to comment Share on other sites More sharing options...
justsomeguy Posted August 3, 2006 Share Posted August 3, 2006 There is a SQL tab in phpMyAdmin where you can just paste or write a query. Get the query that your page creates and paste it in there to see if it runs. Link to comment Share on other sites More sharing options...
The Reverend Posted August 3, 2006 Share Posted August 3, 2006 I don't know how it is on your server, but the one I use requires syntax using ` surrounding the table name and fields, like this: INSERT INTO `site_uploads` (`uid`, `title`, `desc`, `file`, `uploaded`) VALUES ('1', 'Notepad 2', 'Try it!', 'Notepad 2.zip', '2006-08-03') Link to comment Share on other sites More sharing options...
justsomeguy Posted August 4, 2006 Share Posted August 4, 2006 Typically backquotes aren't required, but they can be used for clarification. For example, since "date" is a reserved SQL word, if you have a column named "date" you need to surround it with backquotes when you refer to it. $me =& new SixPack();You have turned yourself into a sixpack, dude! Link to comment Share on other sites More sharing options...
The Reverend Posted August 4, 2006 Share Posted August 4, 2006 I don't see anything wrong with it then. I setup a table to the same specs he's given on my XAMPP deal on my computer and ran the query, it works fine.I think of =& as buy in this case btw. My beer drinking class is a work in progress. Link to comment Share on other sites More sharing options...
benjy355 Posted August 4, 2006 Author Share Posted August 4, 2006 It's working now I needed to fix that for my uploads page Link to comment Share on other sites More sharing options...
ThePsion5 Posted August 4, 2006 Share Posted August 4, 2006 I think of =& as buy in this case btw. My beer drinking class is a work in progress. I don't think that PHP5 supports operator overloading, lol. But while we're at it:foreach($internet as $website){ if($website->doesSuck(array('standards', 'coding', 'content', 'design')) { self::optimize(website); self::sendInvoice(website); self::addToResume(website); }}$income = self::getDisposableIncome();spend($income, array('videogames', 'computerstuff', 'ninjagear');self::increment1337(); Link to comment Share on other sites More sharing options...
benjy355 Posted August 4, 2006 Author Share Posted August 4, 2006 I don't think that PHP5 supports operator overloading, lol. But while we're at it:foreach($internet as $website){ if($website->doesSuck(array('standards', 'coding', 'content', 'design')) { self::optimize(website); self::sendInvoice(website); self::addToResume(website); }}$income = self::getDisposableIncome();spend($income, array('videogames', 'computerstuff', 'ninjagear');self::increment1337(); Hehehe,spend($income, array('videogames', 'computerstuff', 'ninjagear');PHP would return "Unexpected ';' expecting ')' on line 11 of omfglolwtfbbq.php" Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now