View Full Version : SQL problems
The)TideHunter(
31 May 2007, 14:13
Hey, i've never really used sql before, i've tried but to no avail.
What im asking for is a query that will add a new section to the table (preferablly called "coins") and 2 functions which are Get and Set for the coins.
So for example, every member has a coins section (just like posts) and 2 functions like:
function Get takes userid returns coinsamount
function Set takes userid, coinsamount.
I'm really having trouble doing this, any help appreiciated.
Eikinskjaldi
01 Jun 2007, 00:21
Hey, i've never really used sql before, i've tried but to no avail.
What im asking for is a query that will add a new section to the table (preferablly called "coins") and 2 functions which are Get and Set for the coins.
So for example, every member has a coins section (just like posts) and 2 functions like:
function Get takes userid returns coinsamount
function Set takes userid, coinsamount.
I'm really having trouble doing this, any help appreiciated.
You need to add the coins field to the table
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
getter
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
setter
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
The)TideHunter(
02 Jun 2007, 09:18
Thanks so much, exactly what i needed.
EDIT: I'm having problems, i tried this code:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
And i added the column coins successfully to table users.
Whenever i try the page it returns "Resource id #16".
Eikinskjaldi
04 Jun 2007, 00:56
query_read_slave sets the database object with a cursor, it does not return the actual values.
also when not doing a select you should use query_write. (I think...dont quote me on this one)
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
Dismounted
04 Jun 2007, 14:08
also when not doing a select you should use query_write. (I think...dont quote me on this one)
Partly correct, use query_write when WRITING to the database and query_read when READING. Pretty logical actually.
The)TideHunter(
04 Jun 2007, 17:55
Thanks alot guys, its working now.
vBulletin® v3.6.12, Copyright ©2000-2009, Jelsoft Enterprises Ltd.