Raised This Month: $ Target: $400
 0% 

Mysql query and text in db


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
asdcoolpix
Junior Member
Join Date: Aug 2008
Old 04-10-2009 , 10:21   Mysql query and text in db
Reply With Quote #1

All greetings. For me a small problem. To a database to be stored in a cell the number. By operation of the given code all passes as it is necessary. The result is displayed in the server console. I wish to output the text from a cell and to display it in the console. At inquiry there is unit or a zero, and it would be necessary that value of a cell was displayed.

PHP Code:
public xxx(){

    new  
error[256]
    new 
ErrorCode
    g_SqlTuple 
SQL_MakeDbTuple(H_HOST,H_USER,H_PASS,H_DB)
    
SqlConnection SQL_Connect(g_SqlTuple,ErrorCode,error,255)
    
    new 
Handle:Query SQL_PrepareQuery(SqlConnection"SELECT value FROM hmk_update WHERE type='huds'")
    
    if(!
SQL_Execute(Query))
    {
        
SQL_QueryError(Query,error,255)
        
server_print("[HOMKA QDB] Error: %s^n",error);
    }
    
server_print("[HOMKA QDB] NOT Error");
    new 
Data
    Data 
SQL_ReadResult(Query,0)
    
server_print("[HOMKA QDB] result: vakue  huds - %d",Data)


[IMG]http://img237.**************/img237/6158/fucktesttable.jpg[/IMG]
[IMG]http://img237.**************/img237/fucktesttable.jpg/1/w1680.png[/IMG]

Last edited by asdcoolpix; 04-10-2009 at 10:44.
asdcoolpix is offline
Send a message via ICQ to asdcoolpix Send a message via Skype™ to asdcoolpix
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 04-10-2009 , 11:10   Re: Mysql query and text in db
Reply With Quote #2

use %s for strings, %d for numbers, %f for floats and so on
__________________
Hunter-Digital is offline
asdcoolpix
Junior Member
Join Date: Aug 2008
Old 04-10-2009 , 11:18   Re: Mysql query and text in db
Reply With Quote #3

=(
now i am use %s

[IMG]http://img13.**************/img13/7826/fucktesttable2.jpg[/IMG]
[IMG]http://img13.**************/img13/fucktesttable2.jpg/1/w1680.png[/IMG]


and server print
Quote:
[HOMKA QDB] Результат: значение huds -
In what there can be a business?

Last edited by asdcoolpix; 04-10-2009 at 12:32. Reason: =((
asdcoolpix is offline
Send a message via ICQ to asdcoolpix Send a message via Skype™ to asdcoolpix
Old 04-10-2009, 12:42
asdcoolpix
This message has been deleted by YamiKaitou. Reason: bump
Old 04-10-2009, 14:55
asdcoolpix
This message has been deleted by YamiKaitou. Reason: bump
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 04-10-2009 , 14:58   Re: Mysql query and text in db
Reply With Quote #6

Quote:
Originally Posted by asdcoolpix View Post
PHP Code:
public xxx(){

    new  
error[256]
    new 
ErrorCode
    g_SqlTuple 
SQL_MakeDbTuple(H_HOST,H_USER,H_PASS,H_DB)
    
SqlConnection SQL_Connect(g_SqlTuple,ErrorCode,error,255)
    
    new 
Handle:Query SQL_PrepareQuery(SqlConnection"SELECT value FROM hmk_update WHERE type='huds'")
    
    if(!
SQL_Execute(Query))
    {
        
SQL_QueryError(Query,error,255)
        
server_print("[HOMKA QDB] Error: %s^n",error);
    }
    
server_print("[HOMKA QDB] NOT Error");
    new 
Data
    Data 
SQL_ReadResult(Query,0)
    
server_print("[HOMKA QDB] result: vakue  huds - %d",Data)


-->

PHP Code:
public xxx(){

    new  
error[256]
    new 
ErrorCode
    g_SqlTuple 
SQL_MakeDbTuple(H_HOST,H_USER,H_PASS,H_DB)
    
SqlConnection SQL_Connect(g_SqlTuple,ErrorCode,error,255)
    
    new 
Handle:Query SQL_PrepareQuery(SqlConnection"SELECT value FROM hmk_update WHERE type='huds'")
    
    if(!
SQL_Execute(Query))
    {
        
SQL_QueryError(Query,error,255)
        
server_print("[HOMKA QDB] Error: %s^n",error);
    }
    
server_print("[HOMKA QDB] NOT Error");
    new 
szData[32]
    
SQL_ReadResult(Query,0szData31)
    
server_print("[HOMKA QDB] result: vakue  huds - %s",Data)


__________________
In Flames we trust!
Nextra is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 04-10-2009 , 15:01   Re: Mysql query and text in db
Reply With Quote #7

PHP Code:
new Data[10]
SQL_ReadResult(Query,0,Data,9
__________________
joaquimandrade is offline
Reply



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

Forum Jump


All times are GMT -4. The time now is 02:21.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode