The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
simple mysql operations - urgent
Author Message
Shaklaban
Master
**

Posts: 378
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Mar 2012
Reputation: 8

DOT

Post: #2
RE: simple mysql operations - urgent
you can use phpmyadmin for creating tables, its easy to use it. in tables always use index, create column with named id and make it auto increment and index. with that every added row will have id, its useful sometimes.

also if you planning to create large tables with uids index uid columns it will boost the performance

about the other question:

PHP Code:
[function database test]
db.query "SELECT * FROM table WHERE uid = '<uid>' ORDER BY id DESC LIMIT 1"

SELECT FROMthis part means select all columns (column 1column 2)
if 
you want to return single column use SELECT COLUMN1 FROM

WHERE uid 
'<uid>' get the row which has uid=self in uids row (put uids in seperate row)

ORDER BY id DESCorder the returning queries by iddescendinguseful if you are making top15 like systems.

LIMIT 1limit to the returning rowsalways use limits because if sphere return large queries server will freeze so if you want to get the players from database which has most kills use:

[
dialog d_top_15_test]
gump codes...
db.query "SELECT * FROM table WHERE columnuid = '<uid>' ORDER BY KILLS DESC LIMIT 15"
local.x=30
local
.y=30
for 0 14
    ref1
=<db.row.<dlocal._for>.columnuid>
    
dtext <local.x> <local.y1152 <ref1.name>
    
local.+= 20
endfor 
12-05-2012 11:47 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Messages In This Thread
simple mysql operations - urgent - ChaveS - 12-05-2012, 01:00 PM
RE: simple mysql operations - urgent - Shaklaban - 12-05-2012 11:47 PM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)