Hi, i have four tables:books, info, autor, publisher and columns under tables;
books........... info............ autor............. publisher
------------... -------------... ---------------... --------------
id............. id............... id.................id
bookname .......type .............name ..............publisher name
autor_id .......year .............second name .......quantity
publisher_id ...autor............. year..............country

I tried with this relations but it did not work (is this normalization ok)
relations: autor.id = books.autor_id AND publisher.id = books.publisher_id AND info.id = books.id
I need to create relations and to create several reports (lets say name of the autor and his books, name of the publisher and his books)
The question is what is the best way to do that, I tried but the queries didnt work, and id column from autor should have the same data with autor_id column from books table so should i enter the data only in one place or in bouth AND how to use queries many times for displaying data from tables

for one table is SELECT * FROM table

while ($row = mysqli_fetch_array($result)){

echo"row[]";

but what should I do to get result from lets say 2 tables and from several queries?
It must be in php and mysql
THANKS!

Recommended Answers

All 2 Replies

Try

<?php echo row['database_column_name']; ?>

Here 'database_column_name' is the name
of the column
of the result shown in mysql database
by select query.
Hope this was your problem....

the problem is how to form to get results from several queries from multiple tables and for the example the "id" column from autor table should has the same data with the "autor_id" column from the books table and these columns are related with relation autor.id=books.autor_id and "id" at autor table is auto_incremment so the 1 question is how to fill the data in "autor_id" column from the books table since when shares the same data with "id" from autor table.
Question number two is how to display data from several queries (for example query1 = SELECT name, second_name, book, FROM books,autor WHERE autor.id=books.autor_id; query2=SELECT book,publisher_name FROM books, publisher WHERE publisher.id=books.publisher_id) how to create reports and display data for these two queries?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.