Raised This Month: $ Target: $400
 0% 

SQL querys


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Clauu
Senior Member
Join Date: Feb 2008
Location: RO
Old 06-14-2011 , 14:26   Re: SQL querys
Reply With Quote #1

sqlx without threaded query's
PHP Code:
    new g_Error[512],ErrorCode,Handle:SqlConnection SQL_Connect(g_SqlTuple,ErrorCode,g_Error,511);
    
    if(
SqlConnection == Empty_Handle) { 
        
server_print" optional a specific error msg " ); }
    
    else {
    
    
server_print" optional a ok msg ");
    
    new 
szQuery[256];
    
formatexszQuerycharsmaxszQuery ), "SELECT something FROM your_table");
    new 
Handle:Query SQL_PrepareQuery(SqlConnectionszQuery);
   
    if(!
SQL_Execute(Query)) { 
        
server_print(" optional a specific error msg "); }
    
    else if(
SQL_Execute(Query)) {
    
new 
something[32];
    
SQL_ReadResult(Query0somethingcharsmax(something));
    
    
SQL_FreeHandle(Query); SQL_FreeHandle(SqlConnection); 
or with dbi but as i said this is the old way
PHP Code:
    new Sql:dbcResult:result;
    
dbc dbi_connect(SQL_HOST,SQL_USER,SQL_PASS,SQL_DB,error,32);
    
    if (
dbc <= SQL_FAILED) {
        
server_print"optional a specific error msg"); }

    else {
        
    new 
sql[512];
    
format(sql,511,"SELECT something FROM your_table");
    
result dbi_query(dbc,sql);
    
    if (
result <= RESULT_FAILED) {
        
server_print(" optional a specific error msg "); }
 
   else {
    
    if (
result == RESULT_NONE) {
        
server_print(" optional a specific error msg "); }
    
   else {

    new 
something[32] = dbi_field(result1);
    
    
dbi_free_result(result); } } } 
Formatex is optional and the query can be used directly if there is no extra arguments.
Clauu 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 23:34.


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