Hi Chaps, i don’t understand what ive done wrong, however when i try to echo form fields, theres alway noe missing
Database
$dim = @mysql_query('SELECT dims.dimid, dims.dimdesc, dimlinks.prodid, dimlinks.dimlink FROM dimlinks LEFT JOIN dims ON dimlinks.dimlink = dims.dimid WHERE dimlinks.prodid = "20"');
$row_dim = mysql_fetch_assoc($dim);
if (!$dim) {
exit('<p>Unable to obtain links from the database.</p>');
}
Yep. You are reading the first result above your if statement, discarding it, and then looping over the remaining results. Remove the $row_dim = mysql_fetch_assoc($dim); above your if statement and you’ll see all the results you were expecting.
As an aside: mysql is being deprecated and it is preferred to use mysqli or PDO.
Now, i have another problem (title is still relevant so wont bother adding a new post)
Ive never done dynamic field forms from a db before, so im in a bit of a mess…how to a take the field values and insert into a db. Below is where i am at the mo…itll update the values already in the form (hidden field/$utid), however the field where i add data isnt being inserted (“val3”)
Got it sorted …good idea to echo $add, as it showed that the data actually exists…there was a problem with the database structure so i was just entering ‘0’…
thanks anyways B