I'm trying ot query the same table twice, with different Name's for the values.

$query_rt_lmp ="(SELECT  rt_lbmp.lbmp as nyc FROM rt_lbmp WHERE rt_lbmp.`date`='$date' and name='N.Y.C.')
					UNION ALL
				(SELECT rt_lbmp.lbmp as millwd FROM rt_lbmp WHERE rt_lbmp.`date`='$date' and rt_lbmp.name='MILLWD')";

when i do

<?php echo $row_rt_lmp['nyc'];?>
<?php echo $row_rt_lmp['millwd'];?>

I get this:

array
'nyc' => string '26.08' (length=5)
26.08
Notice: Undefined index: millwd in C:\Users\gross.t\Desktop\choicegrid\nyiso\nyiso_table.php on line 55

Why is the millwd value not showing? I've tried union, join... I just can't seem to get it right. Any help or point in the right direction would be greatly appreciated.

Member Avatar for diafol

FOR UNION - all fieldnames must be the same. You can't have millwd in one part of the union and not in the other.

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.