How can i save various IDs obtained by a SQL ql query in one array
#1

Hello guys, i have a question. How can i save IDs obtained by a sql query in one array? (Various IDs obtained in one query)


This is an example of one random table and this is the format of the query
(SELECT ID FROM table WHERE Nombre='Minikole')


ID Nombre
4 Minikole
8 Minikole
14 Minikole
I would save those IDs in array[3] (for example), something like this:
array[0] = 4;
array[1] = 8;
array[2] = 14;


This is all, thank you very much for the help.
Reply
#2

Example:


PHP код:
#define MAX_SLOTS    (50)

new buffer[256], 0;
format(buffer,sizeof buffer,"SELECT ID FROM table WHERE Nombre='Minikole' LIMIT %d",MAX_SLOTS);
mysql_query(buffer);
mysql_store_result();

while(
mysql_retrieve_row()){    
    array[
i] = //<-- save id here
    
i++;
}
mysql_free_result(); 
Reply
#3

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
Example:


PHP код:
#define MAX_SLOTS    (50)
new buffer[256], 0;
format(buffer,sizeof buffer,"SELECT ID FROM table WHERE Nombre='Minikole' LIMIT %d",MAX_SLOTS);
mysql_query(buffer);
mysql_store_result();
while(
mysql_retrieve_row()){    
    array[
i] = //<-- save id here
    
i++;
}
mysql_free_result(); 
thank you very much for the help, i have an aditional question more. in array[i] = how can i obtain the ID, using mysql_fetch_field_row or using cache_get_field_content_int?
Reply
#4

yes
array[i] = cache_get_field_content_int(...);
Reply
#5

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
yes
array[i] = cache_get_field_content_int(...);
in the parameter row, which be it? var i ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)