Array and MySQL
#1

Hello i'm now realy ...

In some of my includes i have this:

Код:
stock GetJobData(field[])
{
  new tmp[MAX_QUERY];
  new result[MAX_QUERY];
  new array[50];

  format(tmp, sizeof(tmp), "SELECT %s FROM %s", field, JOB_TABLE);
  MySQL_query(tmp);
  MySQL_result();
  while(MySQL_fetch(result))
  {
	for(new i=0;i<sizeof(array);i++)
    { 
     array[i]=result[i];
    }
  }
  return array;
}
In my Gamemode i use this:
Код:
  new array[50];
  new formatstring[50];
  new formatarray[50];
  
	array = GetJobData("spawn_x");
	
  for(new i=0; i<sizeof(array); i++)
  {
		format(formatstring, sizeof(formatstring), "%s", array[i]);
		formatarray[i] = formatstring; // (88) : error 006: must be assigned to an array
		print(formatarray[i]);
	}
Error:
Quote:

(8 : error 006: must be assigned to an array

Can you hep me?

AND

Why is there no why to use the content of the database like in php?
Example: print(value[row1]); ?

ThX, my head is bursting equal
Reply


Messages In This Thread
Array and MySQL - by KingArthur - 05.07.2009, 18:40
Re: Array and MySQL - by Nero_3D - 05.07.2009, 18:58
Re: Array and MySQL - by KingArthur - 05.07.2009, 19:07
Re: Array and MySQL - by Nero_3D - 05.07.2009, 19:42
Re: Array and MySQL - by KingArthur - 05.07.2009, 19:48
Re: Array and MySQL - by Nero_3D - 05.07.2009, 20:10
Re: Array and MySQL - by KingArthur - 05.07.2009, 20:24
Re: Array and MySQL - by Nero_3D - 05.07.2009, 20:52
Re: Array and MySQL - by KingArthur - 05.07.2009, 21:12
Re: Array and MySQL - by Nero_3D - 06.07.2009, 12:20

Forum Jump:


Users browsing this thread: 2 Guest(s)