Raised This Month: $ Target: $400
 0% 

Solved Broken table when supposed to work


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
GasmoN
Member
Join Date: Jul 2014
Old 09-28-2021 , 13:58   Broken table when supposed to work
Reply With Quote #1

So I have this code that shows top15 players on the server, and while it works like a charm, I have issue with the HTML part of the code. Table's width is not 100%, and I have tried like 100 times to fix that and it simply won't work. Does anyone at least know what the issue here is and what should I try to do next?
PHP Code:
public mysql_top15(FailStateHandle:QueryError[], ErrcodeData[], DataSize)
{
    if(
FailState)
    {
        
log_amx("SQL Error: %s (%d)"ErrorErrcode);
        return 
PLUGIN_HANDLED;
    }
    
    new 
gMotd[2048];

    if(
SQL_NumResults(Query) > 1)
    {
        new 
szName[33];
        new 
iName;
        new 
iKills;
        new 
iDeaths;
        new 
iHeadshots;

        new 
0;
        new 
len 0;

        
len += formatex(gMotd[len], charsmax(gMotd) - len"<!DOCTYPE html><html>");
        
len += formatex(gMotd[len], charsmax(gMotd) - len"<head><meta name='viewport' content='width=device-width, initial-scale=1'>")
        
len += formatex(gMotd[len], charsmax(gMotd) - len"<meta http-equiv='X-UA-Compatible' content='IE=edge' />")
        
len += formatex(gMotd[len], charsmax(gMotd) - len"<style>table { border-collapse: collapse; width: 100%; border: 1px solid #ddd; } th, td { text-align: left; padding: 16px; }</style></head>");
        
len += formatex(gMotd[len], charsmax(gMotd) - len"<body><br><center><table><tr><th>Rank</th><th>Name</th><th>Kills</th><th>Deaths</th><th>Headshots</th></tr>");
        
        
iName SQL_FieldNameToNum(Query"name");
        
iKills SQL_FieldNameToNum(Query"kills");
        
iDeaths SQL_FieldNameToNum(Query"deaths");
        
iHeadshots SQL_FieldNameToNum(Query"headshots");
        
        
        while (
SQL_MoreResults(Query))
        {
            
len += formatex(gMotd[len], charsmax(gMotd) - len"<tr><td>%d", ++k);
            
            
SQL_ReadResult(QueryiNameszNamecharsmax(szName));
            
            
len += formatex(gMotd[len], charsmax(gMotd) - len"<td>%-22.22s"szName);
            
len += formatex(gMotd[len], charsmax(gMotd) - len"<td>%d"SQL_ReadResult(QueryiKills));
            
len += formatex(gMotd[len], charsmax(gMotd) - len"<td>%d"SQL_ReadResult(QueryiDeaths));
            
len += formatex(gMotd[len], charsmax(gMotd) - len"<td>%d"SQL_ReadResult(QueryiHeadshots));
    
            
SQL_NextRow(Query);
        }
    
        
len += formatex(gMotd[len], charsmax(gMotd) - len"</table></center></body></html>");
        
    }

    
show_motd(Data[0], gMotd"Top 15 Players");
    
    return 
PLUGIN_HANDLED;
    


Last edited by GasmoN; 09-29-2021 at 15:06. Reason: Solved
GasmoN is offline
 


Thread Tools
Display Modes

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 20:26.


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