Re: PHP/MYSQL query error

From: Date: Mon, 26 Aug 2002 14:09:13 +0000
Subject: Re: PHP/MYSQL query error
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-114146@lists.php.net to get a copy of this message
Thank you. I will try that. "Justin French" <justin@indent.com.au> wrote in message news:B99071C8.EADA%justin@indent.com.au... > Why don't you do > > $result = mysql_query($query) or die(mysql_error()); > > or > > $result = mysql_query($query); > echo mysql_error(); > > That way, instead of "Query Failed" you'll get something meaningful... > probably something that will solve the problem. > > > Justin French > > > on 26/08/02 11:55 PM, Chris Crane (ccrane@inxdesign.com) wrote: > > > Initially there was an error with too many values verses columns. But I > > think it was fixed. I am double checking now. > > > > > > "Jay Blanchard" <jay.blanchard@niicommunications.com> wrote in message > > news:003201c24d07$b8560470$8102a8c0@000347D72515... > >> [snip] > >> /* Performing SQL query */ > >> $query = "INSERT INTO SignupRequests ('FirstName', > >> 'LastName', > >> 'Address1', 'Address2', > >> 'City', 'State', 'Zip', 'Email', > >> 'Phone', 'ContactMethod', 'Date', > >> 'IP', 'Status', 'Comments') > >> VALUES ('', 'Chris', 'Crane', '655 Talcottville > >> Road', 'Apt. 185', > >> 'Vernon', 'CT', '06066', > >> 'ccrane@inxdesign.com', > >> '860-659-6464', 'Email', 'August 25, 2002', > >> '64.252.232.82', 'Newly > >> Requested', 'Testing')"; > >> $result = mysql_query($query) or die("Query failed"); > >> [/snip] > >> > >> Have you printed the query to make sure that the syntax is right? The > > first > >> thing that I see is that there are 13 items in your INSERT statement and > > 15 > >> items in your VALUES statement ... these must match in order for the query > >> to work. > >> > >> > >> HTH! > >> > >> Jay > >> > >> Ask smart questions: > >> http://www.tuxedo.org/~esr/faqs/smart-questions.html > >> Top Questions on php-general; > >> (Answers can be found by RTFM, STFW, or STFA, > >> save for #3 and #6 which can probably be found > >> the same way, since they are usually one of the > >> other questions on this list.) > >> 1. How can I make file uploads work? > >> 2. How come my form will not pass variables? > >> 3. HELP! HELP! Please HELP! > >> 4. Register_Globals ?!? > >> 5. Is there a function to ... [insert thought here]? > >> 6. Anyone see the error in this code? > >> > >> > > > > >

« previous php.general (#114146) next »