Hi all,
I just got - as many others - such a newbie question I seem cannot get over or being able to solve it by myself.
So any further ado, let's go:
I have stored lots of info regarding technical, computing and programming books into MySQL database.
I am able to fetch infos from MySQL database by using PHP just fine. I've done very primitive frontend that suits my needs. It prints out infos regarding book author, title, isbn, year when published and so on and so on.
I've also stored Chapter index of every book and now comes the tricky part:
I'm able to print out also chapter index but not really the way I want; in MySQL table, there's 150 fields which all can be used to store chapter info.
I've created up to 150 fields in the database table as I believe it's sufficient for my needs.
Everything's still fine but as some books got smaller chapter index, let's say, 48 entries and some books may have chapter index over 100 entries.
I fetch all the data from the database table (150 fields) and I've genereated an array which goes until the end of the table entries and generates the list from that amount.
Everything has been printed out but for the book with only 48 chapter index entries, there's additional 102 EMPTY entries following the first 48.
So basically for every book I've got stored in MySQL database,
my PHP script prints out the complete 150 entries regardless amount of entered real chapter data into database.
I want to limit the entries to be printed out to the amount of real data entered in MySQL database. So if there's 48 entries of chapter index, there should be printed out only those 48 entries, instead of 150 entries, the size of my database table total fields.
I would really appreciate a lot if someone would come up with hints how to get further. I feel like I'm stuck in the middle and cannot get this done the way I want.
Thanks a lot in advance. Sorry if this post appeared in a wrong forum.