Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 2nd Jun 2011, 12:54 PM   #1
Active Warrior
War Room Member
 
mikereisinger's Avatar
 
Join Date: 2011
Location: Indianapolis, Indiana
Posts: 59
Thanks: 2
Thanked 11 Times in 11 Posts
Default
help with syntax error
Share on: 
fb share twitter share gplus share more share

Trying to set up WP clickbank membership plugin. After test order, when I click complete this order I get the following error:


Invalid query -- SELECT * FROM `wp_usermeta` WHERE `user_id`= and `meta_key`='wp_capabilities' LIMIT 1 -- 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 'and `meta_key`='wp_capabilities' LIMIT 1' at line 1


The following is the associated file where I think the problem is...

<?
require_once 'txconfig.php';

$rcpt=$_REQUEST['cbreceipt'];
$time=$_REQUEST['time'];
$item=$_REQUEST['item'];
$cbpop=$_REQUEST['cbpop'];
$wpid=$_REQUEST['wpid'];
$xxpop=sha1("$key|$rcpt|$time|$item");
$xxpop=strtoupper(substr($xxpop,0,8));

if ($cbpop!=$xxpop) {exit("Security Error - Logged.");}

// Access the wordpress database and upgrade user from subscriber to paidmember.
$metachange='wp_capabilities';
$res = query("SELECT * FROM `wp_usermeta` WHERE `user_id`=$wpid and `meta_key`='wp_capabilities' LIMIT 1");
$row = mysql_fetch_assoc($res);
$subscriber=$row[meta_value];
$um=$row[umeta_id];
$paidmember=str_replace('subscriber','paidmember', $subscriber);
$res = query("UPDATE `wp_usermeta` SET `meta_value`='$paidmember' WHERE `umeta_id`='$um'");
$thankyoupage="Location: $thankyoupage";
header($thankyoupage);
?>


Thanks for any help you could provide!


Last edited on 2nd Jun 2011 at 12:58 PM. Reason: typo!
mikereisinger is offline  
Unread 2nd Jun 2011, 04:09 PM   #2
HyperActive Warrior
War Room Member
 
NickL's Avatar
 
Join Date: 2007
Location: Fair Oaks, CA
Posts: 561
Thanks: 81
Thanked 347 Times in 110 Posts
Blog Entries: 2
Default
Re: help with syntax error
Share on: 
fb share twitter share gplus share more share

you are missing a value between 'user_id' = and and 'meta_key'.

SELECT * FROM `wp_usermeta` WHERE `user_id`= 'need something or null here' and `meta_key`='wp_capabilities' LIMIT 1

Also - watch out when you copy-paste - sometimes the single quotes can actually be different character codes... use notepad to clean them up...

Good luck!

Have an Excellent Day!

~ Nick
NickL is offline  
Unread 2nd Jun 2011, 05:20 PM   #3
VIP Warrior
War Room Member
 
Join Date: 2006
Location: , , USA.
Posts: 1,795
Thanks: 70
Thanked 287 Times in 259 Posts
Default
Re: help with syntax error
Share on: 
fb share twitter share gplus share more share

Originally Posted by NickL View Post

you are missing a value between 'user_id' = and and 'meta_key'.
In other words, the variable $wpid doesn't have a value.
KirkMcD is offline  
Unread 16th Jun 2011, 01:48 PM   #4
Thank You Coach and Mento
 
smackey1's Avatar
 
Join Date: 2011
Location: Chatham, IL
Posts: 12
Thanks: 0
Thanked 3 Times in 3 Posts
Default
Re: help with syntax error
Share on: 
fb share twitter share gplus share more share

So what should the variable be?

Shawn Mackey
My guaranteed techniques will have you increasing profits within 30 days. Grow your business by building better relationships and increase customers, referrals, and profits..
smackey1 is offline  
Closed Thread


Bookmarks

Tags
error, syntax


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




All times are GMT -6. The time now is 09:58 AM.