mysql loading houses
#2

With the new SQL plugin, it will send the cache to a callback specified in the tquery function as far as I understand. What you want to get done, should work like this (click me to go to pastebin, the forum messed up the code once posted)


I haven't tested the code, but this is how I do it in my script, and it works fine. As you might see, I replaced the for loop with the MAX_HOUSES with the amount of records loaded from the database. I also replaced the '0', the first parameter of the cache_get..... function with the 'i' variable. Now, the loop only goes as far as the amount of houses found in the database, and will give the correct value to each house variable. If you would have used the code as it was before, you would have arrays the size of MAX_HOUSES, filled with the same value (since you only took the value of row 0 each loop).

Another thing that was just optional, you formatted a string for this query (Hstring). I couldn't find any use for the string formatting in the code, meaning that you can just write the query in the query function. I also changed that as well, you can revert back on that if you like it better.
I placed some comments throughout the function to let you know what we do. If it doesn't work or if you have any questions, just post back here and we'll have a look
Reply


Messages In This Thread
mysql loading houses - by TheDarkBlade - 24.09.2016, 06:35
Re: mysql loading houses - by Jstylezzz - 24.09.2016, 07:35
Re: mysql loading houses - by TheDarkBlade - 24.09.2016, 08:10
Re: mysql loading houses - by Jstylezzz - 24.09.2016, 08:53
Re: mysql loading houses - by TheDarkBlade - 24.09.2016, 09:21
Re: mysql loading houses - by Jstylezzz - 24.09.2016, 10:06
Re: mysql loading houses - by TheDarkBlade - 24.09.2016, 14:18
Re: mysql loading houses - by TheDarkBlade - 24.09.2016, 16:49
Re: mysql loading houses - by Jstylezzz - 24.09.2016, 19:03
Re: mysql loading houses - by TheDarkBlade - 25.09.2016, 07:40

Forum Jump:


Users browsing this thread: 2 Guest(s)