0

I looked at the print_r() function, I never knew what it was but it looks like it could be useful. Thanks for that.

OK everything is working as it should now: species, year, sex, price and the correct subcat id are being entered into the table as expected. But on initial page load it still gives the same error which disapears after the first form submit.It doesnt come back if you keep submitting more animals to the db. Like I said, all seems to be working fine but its not nice seeing the error at the start.
Any ideas why this would happen?

0

It seems to be sorted now. I had initially changed

   $r = mysql_query("SELECT subcat_id, subcategory_label FROM subcategories ORDER BY cat_id");

to ORDER by subcat_id as the above put 'other lizards' above the list of named categories instead of after. But after changing it back, the error did not appear at all. I can live with one category being out of sequence!

0

You can set a ranked order by altering your subcat table:

subcat_id | subcat_label | subcat_order | cat_id

The subcat_order is an integer or tinyint field, so you can set the order you want them to appear in.

You can then do

$r = mysql_query("SELECT subcat_id, subcategory_label FROM subcategories ORDER BY subcat_order");
0

Thanks for all your help on this, its greatly appreciated. This is solved now.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.