So I have two databases that have separate pieces of information that I need together. Instead of running queries on each database I was told that I can join the two databases together so that I can declare variables from both databases without worrying about which database was specified or what not. Here's what I have so far

$query = "select * from quotes WHERE qSymbol='{$strSymbol}' ORDER BY qQuoteDateTime DESC LIMIT 15";

I want to have all fields in the quotes database as well as all database in the symbols database to be accessible without having to specifically call each database. How can I add on to this code to let me do that?

Thank you all!

Okay so what is wrong with this then? I keep getting "invalid" as a result..

$query = "SELECT symSymbol, symName, symMarketCap, qSymbol, qQuoteDateTime, qLastSalePrice, qNetChangePrice, qNetChangePct, qTodaysHight, qTodaysLow"
			."qShareVolumeQty, qPreviousClosePrice, qBidPrice, qAskPrice, q52WeekHigh, q52WeekLow, qCashDividendAmount, qEarningsPerShare, qCurrentPERatio"
			."qCurrentYieldPct, qTotalOutstandings FROM symbols LEFT JOIN quotes ON symSymbol=qSymbol WHERE symSymbol='{$strSymbol}' ORDER BY qQuoteDateTime"
			."LIMIT 10";

	$result = @$db->query($query);

	if(!$result)
	{
		print "Invalid";
	}
	else
	{
		$row = @$result->fetch_assoc();
		extract($row);
	}

if you have phpmyadmin then , get output your query using echo, then copy that query to phpmyadmin, and run. see what error you are getting there.

.
.
.
$query="SELECT symSymbol,................. LIMIT 10";

echo $query;

$result = @$db->query($query);
.
.
.
.

You forget two commas in field selection after qTodaysLow and qCurrentPERatio shown in red color.
Give space after qQuoteDateTime.

$query = "SELECT symSymbol, symName, symMarketCap, qSymbol, qQuoteDateTime, qLastSalePrice, qNetChangePrice, qNetChangePct, qTodaysHight, qTodaysLow, "
			."qShareVolumeQty, qPreviousClosePrice, qBidPrice, qAskPrice, q52WeekHigh, q52WeekLow, qCashDividendAmount, qEarningsPerShare, qCurrentPERatio, "
			."qCurrentYieldPct, qTotalOutstandings FROM symbols 
			LEFT JOIN quotes ON symSymbol=qSymbol 
			WHERE symSymbol='{$strSymbol}' 
			ORDER BY qQuoteDateTime "
			."LIMIT 10";
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.