Ok I have been working with PHP for years but am not very skilled at arrays..
I am working on an existing class which was used to generate forms and the mysql query to insert the generated form.. However, this only supported one table, predefined at the start of the script. This will not work for this project and I need to make it support multiple tables.. And it's been breaking my brain!
Maybe I'm just missing something, but I couldn't find an easy way to do it..
So far I have managed to generate 3 arrays with the necessary info:
$fields (field name in the database)
$values (the value that belongs to the field)
$table (the table that field should be inserted into)
Example:
$fields[0] = 'name'
$values[0] = 'Tony'
$table[0] = 'users'
$fields[1] = 'adres'
$values[1] = 'Sesamestreet 17'
$table[1] = 'adres'
$fields[2] = 'name'
$values[2] = 'Albert'
$table[2] = 'users'
There's just one problem, the $table array holds multiple tables, as you can see..
I need to check how many different ones there are to start with, which is already beyond me.. (I'm more of a mysql buff, but of course there's no "count(*) where xxx = xxx" )
Am I just thinking way too difficult again (like usual)?