Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
MySQL INSERT into, WHERE error, totally confused!
Old 12-23-2007, 01:26 PM MySQL INSERT into, WHERE error, totally confused!
J0ker's Avatar
Skilled Talker

Posts: 61
Trades: 0
I ran this simple code and it turned up a MySQL error and I have utterly no idea why. I am 100% sure the variables have content in them, but I even tried removing them and puting dummy data like "hi" etc, and still had the problem so its not that.

PHP Code:
mysql_query("INSERT INTO Links (bid) VALUES('$payment_amount') WHERE url='$item_number'"
or die(
mysql_error()); 
I even went into phpMyAdmin and ran just the SQL:

PHP Code:
INSERT INTO Links (bidVALUES('$payment_amount'WHERE url='$item_number' 
It errored there as well. I am totally confused! Am I doing something stupid?
__________________

Please login or register to view this content. Registration is FREE
- Free Gaming Forum/Arcade

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
J0ker is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-23-2007, 02:20 PM Re: MySQL INSERT into, WHERE error, totally confused!
J0ker's Avatar
Skilled Talker

Posts: 61
Trades: 0
Ok, yeah I was doing something stupid figured it out though. There isn't such thing as a WHERE in an insert, you have to update. Here is what I did instead and it worked:

PHP Code:
mysql_query("UPDATE Links SET bid = '$payment_amount' WHERE url = '$item_number'") or die(mysql_error()); 
__________________

Please login or register to view this content. Registration is FREE
- Free Gaming Forum/Arcade

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
J0ker is offline
Reply With Quote
View Public Profile
 
Old 12-23-2007, 03:01 PM Re: MySQL INSERT into, WHERE error, totally confused!
Harlequin's Avatar
Extreme Talker

Posts: 166
Name: Mick
Location: Tenerife
Trades: 0
PHP Code:
UPDATE `LinksSET `bid` = '$payment_amount' WHERE `url` = '$item_number'
__________________

Please login or register to view this content. Registration is FREE

Death Once Had a Near Harlequin Experience...!
Harlequin is offline
Reply With Quote
View Public Profile Visit Harlequin's homepage!
 
Reply     « Reply to MySQL INSERT into, WHERE error, totally confused!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11671 seconds with 12 queries