MySQL/R33
#5

The thing is that auto increment is not set to "houseid" column. There are more issues than that with the code itself:
- Executing 50 queries when 1 is enough (looping through the rows returned, there's rowid in cache_get_row(_int/_float) functions).
- Not specifying callback to retrieve the data afterwards.
- Calling cache functions out of the callback will result in warnings for no active cache.

Enable auto increment for "houseid" column and don't have it as variable[index] where index is the "houseid" from the database. Have a separate variable that will hold each "houseid" from the database so you can update according to that the correct row («here»).

As for the command: When first loading the houses, have a global variable that will store the houses loaded. In the command, check if the value of the variable is not equal to the max houses (reached limit) and assign the appropriate values to the array with index the value of the global variable that stores the number of loaded houses. When you do that, execute an INSERT query to insert a new record and specify a callback in which you'll retrieve the "houseid" from the database returned using cache_insert_id function as the above users already mentioned. Store it to the variable I mentioned above (look at «here» because I mentioned more).
Reply


Messages In This Thread
MySQL/R33 - by Juvanii - 02.07.2016, 14:57
Re: MySQL/R33 - by Vince - 02.07.2016, 15:00
Re: MySQL/R33 - by Juvanii - 02.07.2016, 15:24
Re: MySQL/R33 - by SecretBoss - 02.07.2016, 15:27
Re: MySQL/R33 - by Konstantinos - 02.07.2016, 15:50
Re: MySQL/R33 - by Juvanii - 02.07.2016, 16:32
Re: MySQL/R33 - by [cS]Owain - 02.07.2016, 16:41

Forum Jump:


Users browsing this thread: 1 Guest(s)