[SOLUCIONADO] Hacer un menu obteniendo datos de una tabla
#1
Hola, no soy muy experto en lo que respecte a Sql, y necesitaria saber como podría hacer para crear un menú y obtener los datos de una tabla.
La tabla esta creada de esta forma.

Código PHP:
len += formatex(sz_texto[len], charsmax(sz_texto) - len"CREATE TABLE IF NOT EXISTS %s ("DB_TABLA_ADMINS);
len += formatex(sz_texto[len], charsmax(sz_texto) - len"'id' INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, ");
len += formatex(sz_texto[len], charsmax(sz_texto) - len"'Nombre' VARCHAR(32) NOT NULL UNIQUE, ");
len += formatex(sz_texto[len], charsmax(sz_texto) - len"'Contrasena' VARCHAR(34) NOT NULL, ");
len += formatex(sz_texto[len], charsmax(sz_texto) - len"'Flags' VARCHAR(32) NOT NULL DEFAULT '', ");
len += formatex(sz_texto[len], charsmax(sz_texto) - len"'Acceso' VARCHAR(32) NOT NULL DEFAULT 'e', ");
len += formatex(sz_texto[len], charsmax(sz_texto) - len"'Vencimiento' VARCHAR(12) NOT NULL DEFAULT '', ");
len += formatex(sz_texto[len], charsmax(sz_texto) - len"'Rango' VARCHAR(20) NOT NULL DEFAULT 'e')"); 

y qusiera hacer un menú, por ejemplo de todas las filas y que quede algo así.

Código PHP:
1. ID: %Nombre: %Contraseña: %s
2. ID
: %Nombre: %Contraseña: %s
3. ID
: %Nombre: %Contraseña: %

Obteniendo todos los resultados que arroje la consulta pero no tengo mucha nocion de si tengo que hacer un for o algo así.
Gracias de antemano.
___________________________________
SI NECESITAS UN PLUGIN TE LO HAGO $$$
COMUNICATE A MI DISCORD: emanuelitop15
Responder
#2
consulta
Código PHP:
public checkTopid )
{
    new szTabla200 ], iData];
    
    iData
] = id;
    iData] = TOP15;
    formatexszTablacharsmaxszTabla ), "SELECT Pj, rango, frags FROM %s INNER JOIN zp_cuentas ON id = id_cuenta ORDER BY rango DESC, frags DESC LIMIT 8"szTable );
    
    SQL_ThreadQuery
(g_hTuple"DataHandler"szTablaiData);
    


si existen datos
Código PHP:
case TOP15:
        {
            if( SQL_NumResultsQuery ) )
            {
                static lenszBufferMAX_MOTD_LENGTH-], iszName32 ];
                len 00;

                len format(szBuffer[len], charsmax(szBuffer) - len"<meta charset=UTF-8>\
            <style>*{margin:0px;}body{color:#fff;background: rgba(2, 0, 0, 0.2) url(https://images7.alphacoders.com/570/570405.png); background-repeat: no-repeat; background-size: cover; background-attachment: fixed;}table{border-collapse:collapse;border: 1px solid #ffff;text-align:center;}</style>\
            <body><table width=100%% border=1><tr bgcolor=#4c4c4c style=^"
color:#fff;^"><th width=5%%>#<th width=50%%>Usuario<th width=15%%>Rango\
            <th width=15%%>EXP<th width=15%%>Insignea");
                while( SQL_MoreResults( Query ) )
                {
                    SQL_ReadResult( Query, 0, szName, charsmax( szName ) );
                    len += format( szBuffer[len], charsmax(szBuffer) - len, "
<tr><td>%i<td>%s<td>%s<td>%d<td><img src=^"%s^" width=80 hight=30/>",
                        i+1, szName, g_aRangos[ SQL_ReadResult( Query, 1 ) ][ rango_name ], SQL_ReadResult( Query, 2 ), g_aRangos[ SQL_ReadResult( Query, 1 ) ][ url_rango ] );
                    ++i;
                    SQL_NextRow( Query );
                }
                show_motd( id, szBuffer, "
Top 8 Rangos" );
            }
        } 

cambias el motd por el menú y ya

select Contrasena, Nombre, id from ...
[Imagen: zcsztw-4.png] [Imagen: 6u5fj2-4.png]
[Imagen: linkedin_thumb_image.png][Imagen: 76561198283253977.png][Imagen: linkedin_thumb_image.png]
Responder
#3
Dale muchisimas gracias <3
___________________________________
SI NECESITAS UN PLUGIN TE LO HAGO $$$
COMUNICATE A MI DISCORD: emanuelitop15
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)