0
$w3 = mysql_query( "SELECT * FROM w3" ) or die("SELECT Error: ".mysql_error());   
$worth = mysql_query( "SELECT * FROM worth" ) or die("SELECT Error: ".mysql_error());    
// fetching data 
while ($get_w3 = mysql_fetch_assoc($w3db) && $get_worth = mysql_fetch_assoc($worth))
{
		// Loading Urls for Comparing
	    echo $w3url=$get_w3['domain'];	   // cant echo	
	    echo $worthurl=$get_worth['domain'];  // ok printed

the code seems to be ok .. but i do not know why it cant print ( echo $w3url=$get_w3; )

please help
also is there any way to use separate while loops and compare data i use one while loop
for tow data fetches because i have to compare data of both tables

Edited by nova37: n/a

4
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by ko ko
0

This looks like an odd loop. I'd use a UNION for this, seeing as the data from each table is the same type/name.

(SELECT `domain`, 'w3' as source FROM w3)
UNION
(SELECT `domain`, 'worth' as source FROM worth);
ORDER BY `domain`


That'll give you a mix, with duplicates next to each other (below).

Edited by diafol: n/a

0

change this line

$w3 = mysql_query( "SELECT * FROM w3" ) or die("SELECT Error: ".mysql_error());

to

$w3db = mysql_query( "SELECT * FROM w3" ) or die("SELECT Error: ".mysql_error());
0

mysql_fetch_assoc($w3db), change $w3db to $w3 or use @ardav method. It is better way.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.