mad easy quick question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

mad easy quick question

Post by John Cartwright »

How do I merge 2 querys together

$result = @mysql_query("SELECT * FROM records_cal ORDER BY `date` DESC");

and

$result = @mysql_query("SELECT * FROM records_scrim ORDER BY `date` DESC");
Cruzado_Mainfrm
Forum Contributor
Posts: 346
Joined: Sun Jun 15, 2003 11:22 pm
Location: Miami, FL

Post by Cruzado_Mainfrm »

can you show us what the tables look like?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

both tables are the exact same

and include this

$date = $row["date"];
$outcome = $row["outcome"];
$league = $row["league"];
$map = $row["map"];
$opponent = $row["opponent"];
$league = $row["league"];
Cruzado_Mainfrm
Forum Contributor
Posts: 346
Joined: Sun Jun 15, 2003 11:22 pm
Location: Miami, FL

Post by Cruzado_Mainfrm »

i think...

Code: Select all

SELECT * FROM records_cal,records_scrim ORDER BY records_cal.date DESC, records_scrim.date DESC
note: i edited it
note: edited again... after u posted
Last edited by Cruzado_Mainfrm on Thu Feb 12, 2004 8:41 pm, edited 2 times in total.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Error performing query: Column: 'date' in order clause is ambiguous

:S
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

This is really weird..

basically my script checks to see which variable is being loaded and depending which one a different queries are loaded.

http://www.jcartonline.com/xe

on the left you will see the records thing and it sais cal-o - info....scrim - info.... total - info.....

check out cal-o and scrim info then look at total... the only different in between these are that a different query is being loaded. They are all running from records.php.. check it out

the total is basically just getting both the queries together, oither than that they r identical scripts but the total is really weird.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Nvm, when I add records I'm going to make it go into 2 different tables,

For example I'm entering a cal match.

It creates 1 copy in cal_table and 1 copy in total_table .

Seems like the only way @ my skill level
Post Reply