2 Database Tables (not 2 datatables)
2 Database Tables (not 2 datatables)
Sanjay
Posts: 6Questions: 0Answers: 0
Having spent the last 3 or so hours on this site and implementing many versions of this fantastic application, on a XAMPP and also live hosting, purely for learning and experience, I have a problem I hope I could be helped with.
I have successfully managed to connect a database connection and single database table and all works well, but I wanted to expand this to have this application work with 2 database tables.
Essentially Database_Table_TWO has a foreign key which is the primary key of Database_Table_ONE, so while viewing all rows from Database_Table_TWO, additional data can be presented which is held in Database_Table_ONE (thus avoiding unnecessary duplication of data).
I realise I have no code to show here, but viewing "server_processing.php" I see
[code] ...
/* DB table to use */
$sTable = "Database_Table_NAME";
... [/code]
so, would I begin by declaring the second Database_Table_NAME above. Any pointers would be much appreciated. Thanks...
I have read many of the 2 table posts but feel they are in fact 2 DataTables issues and not 2 database tables related.
I have successfully managed to connect a database connection and single database table and all works well, but I wanted to expand this to have this application work with 2 database tables.
Essentially Database_Table_TWO has a foreign key which is the primary key of Database_Table_ONE, so while viewing all rows from Database_Table_TWO, additional data can be presented which is held in Database_Table_ONE (thus avoiding unnecessary duplication of data).
I realise I have no code to show here, but viewing "server_processing.php" I see
[code] ...
/* DB table to use */
$sTable = "Database_Table_NAME";
... [/code]
so, would I begin by declaring the second Database_Table_NAME above. Any pointers would be much appreciated. Thanks...
I have read many of the 2 table posts but feel they are in fact 2 DataTables issues and not 2 database tables related.
This discussion has been closed.
Replies
All wonderful stuff, but having spent many hours again tonight trying to implement the JOIN suggestion (on 2 database tables), and having read many (but what seems like all at this point) of the relevant forum posts, I am a little surprised no working "2 database tables" example has been provided.
Of course it is my lack of knowledge here that is the issue and not the developer or the site (which both seem wonderful), but could I implore the developer (Allan) to provide a suitable simple example at some point in the future.
p.s. I have read somewhere and agree it is not at all possible to supply examples for every single implementation, but a simple 2 database table example with 3 fields each and perhaps a handful of records, connected with primary and foreign keys, would be so super helpful (to so many of us).
[quote]could I implore the developer (Allan) to provide a suitable simple example at some point in the future.[/quote]
If you really want Allan to come up with a tailored solution, please consider buying support: http://datatables.net/support. In the end, Allan has to pay his bills as well :)
No it's not a tailored solution I was looking for at all. But having read a great deal of similar difficulties as mine, I just thought a simple example as stated above would be hugely useful (again, not just for me, but for many of the unresolved threads I have read on this particular matter).
Thanks for your input...
Allan
A huge help was found in another post, which I will link to here in case anyone else comes across this thread and had the same initial difficulty understanding usage.
LINK: http://datatables.net/forums/discussion/4215/pulling-data-from-multiple-mysql-tables...-need-help-please/p1
or Search:
"Pulling data from multiple mySQL tables... NEED HELP please!"