21.01.2019, 18:29
You confuse it with SELECT queries. You cannot execute an INSERT query and expect to retrieve data (excluding the auto generated value). When a house ID is set as primary key and auto increment, you can specify a callback and retrieve it using mysql_insert_id(). The loop is only used to find a free slot for the array index but the house ID is the identifier to the database. If the `houses` table does not have it, then create it.