05.07.2012, 09:37
Don't use a wildcard(*) when you want to select a whole collumn of data. Wildcard selects every collumn, i.e waste of memory.
Replace "collumn_name" with whatever collumn you're trying to return, and that query will return every thing in the specified collumn.
To access it, here is an example.
Since result is only one string, you'll need to store the results into a 2d array.
Код:
SELECT collumn_name FROM `watchlist`
To access it, here is an example.
pawn Код:
CMD:watchlist(playerid, params[])
{
mysql_query("SELECT * FROM `watchlist`"); // select all from watchlist
mysql_store_result(); // store the result
new
result[24];
while(mysql_retrieve_row())
{
mysql_fetch_field_row(result, "player");
printf("Result: %s", result); // Attempting to display the result (which only displays the first row)
}
mysql_free_result();
return 1;
}
pawn Код:
CMD:watchlist(playerid, params[])
{
mysql_query("SELECT * FROM `watchlist`"); // select all from watchlist
mysql_store_result(); // store the result
new
result[mysql_num_rows()][24],
i=0;
while(mysql_retrieve_row())
{
mysql_fetch_field_row(result[i], "player");
printf("Result: %s", result); // Attempting to display the result (which only displays the first row)
i++;
}
mysql_free_result();
return 1;
}