| | |
Getting results from using 2 tables
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2008
Posts: 20
Reputation:
Solved Threads: 0
Hi can someone shed some light on this problem I'm having please?
2 tables
SHOWS_ARCHIVE (TABLE 1)
ID
SHOW_ID
AUTHOR
SHOWS (TABLE 2)
ID
When the member logs in they are a loud to see their shows because of the $author permissions;
but I want to do is see the results using the SHOWS table ID as well. ie
2 tables
SHOWS_ARCHIVE (TABLE 1)
ID
SHOW_ID
AUTHOR
SHOWS (TABLE 2)
ID
When the member logs in they are a loud to see their shows because of the $author permissions;
MySQL Syntax (Toggle Plain Text)
if ($_SESSION['MEMBER_PERM'] == "2") { $author = $_SESSION['MEMBER_ID']; $sql = mysql_query("SELECT * FROM show_archive WHERE author = $author"); }
but I want to do is see the results using the SHOWS table ID as well. ie
if ($_SESSION['MEMBER_PERM'] == "2")
{
$author = $_SESSION['MEMBER_ID'];
$sql = mysql_query("SELECT * FROM show_archive WHERE author = $author AND show_id = `shows` id");
}•
•
Join Date: Dec 2008
Posts: 11
Reputation:
Solved Threads: 0
Hi,
Try the following:
That should help you retrieve data from 2 tables at the same time. Let us know how it works.
Try the following:
MySQL Syntax (Toggle Plain Text)
if ($_SESSION['MEMBER_PERM'] == "2") { $author = $_SESSION['MEMBER_ID']; $sql = mysql_query("SELECT *, * FROM show_archive, shows WHERE author = $author AND show_id = `shows` id"); }
That should help you retrieve data from 2 tables at the same time. Let us know how it works.
•
•
Join Date: Nov 2008
Posts: 20
Reputation:
Solved Threads: 0
Found the solution!
MySQL Syntax (Toggle Plain Text)
SELECT * FROM show_archive, shows WHERE show_archive.show_id = shows.id
![]() |
Similar Threads
- How to properly use tables in db? (PHP)
- php drop down menu to search multiple sql tables (PHP)
- positioning tables with asp (ASP)
- Full-text search on two tables (PHP)
- Search two tables (PHP)
- updating 2 HTML tables on one PHP page (PHP)
Other Threads in the MySQL Forum
- Previous Thread: help indeed!!! inserting html data in mysql column
- Next Thread: Getting Random Record from Query
| Thread Tools | Search this Thread |
Tag cloud for MySQL
1 agplv3 alfresco api artisticlicense aws bizspark breathalyzer camparingtocolumns changingprices cmg communityjournalism contentmanagement contractors copyright court crm data database design developer development distinct dui eliminate email enter enterprise error eudora facebook form foss gnu government gpl greenit groupware hiring hyperic images innerjoins insert ip joebrockmeier join keyword keywords kickfire laptop law legal license licensing linux maintenance managing mariadb matchingcolumns metron microsoft microsoftexchange montywidenius multiple music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opengovernment opensource operand oracle penelope php query referencedesign reorderingcolumns results resultset saas search select sharepoint simpledb sourcecode spotify statement sugarcrm syntax techsupport thunderbird transparency update virtualization





