Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
eupher
Apprentice


Joined: 18 Jan 2001
Posts: 116
Location: USA

PostPosted: Thu Jun 19, 2014 2:49 pm   

Inserting SET values in MySql
 
CMUD Pro 3.34
MySQL 5.5.36

I have a script to capture item stats into a CMUD database record. Once all of the stats are received, I use the record set returned from %sql() to either $row.Insert() or $row.update(), depending on whether the item is already in the database. I then set values for various columns in the row...

$row.Item("name") = %concat(%db(@itemStats,name))
$row.Item("level") = %db(@itemStats,level)
$row.Item("location") = %concat(%db(@itemStats,location))

I finish it up with a call to $row.Post().

Everything is working except the SET columns, like the "location" column. Depending on how I format the text in %db(@itemStats,location), I either get ONLY the first value or I get nothing at all...

<string> <value>
right_hand,left_hand -> right_hand
'right_hand','left_hand' -> nothing
('right_hand','left_hand') -> nothing

If anyone knows what I'm doing wrong, I'd greatly appreciate some help.

Thanks
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Thu Jun 19, 2014 5:34 pm   
 
Haven't tested, but at a glance at the mysql documentation, it looks like the syntax should be 'right_hand, left_hand'.
Reply with quote
eupher
Apprentice


Joined: 18 Jan 2001
Posts: 116
Location: USA

PostPosted: Thu Jun 19, 2014 6:01 pm   
 
Yeah, that's one of the 3 versions I've tried. It yields no value for that column in the database.

Thanks
Reply with quote
eupher
Apprentice


Joined: 18 Jan 2001
Posts: 116
Location: USA

PostPosted: Thu Jun 19, 2014 6:06 pm   
 
Scratch that... I misread your post. That's now one of the 4 versions I've tried. :)

It still leaves no value for that column in the database, though. :(
Reply with quote
eupher
Apprentice


Joined: 18 Jan 2001
Posts: 116
Location: USA

PostPosted: Thu Jun 19, 2014 6:23 pm   
 
('right_hand,left_hand') also does not work. What am I missing here? :)
Reply with quote
eupher
Apprentice


Joined: 18 Jan 2001
Posts: 116
Location: USA

PostPosted: Thu Jun 19, 2014 6:28 pm   
 
Ok, I finally got it. For anyone else that might be trying to do this in the future... the syntax for the SET value must have:

No quotes of any kind
No space after the comma

Example: right_hand,left_hand

Thanks again for looking.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net