Forum Moderators: coopster

Message Too Old, No Replies

S.O.S : php,mysql variables!

         

parisa

7:13 am on Sep 7, 2005 (gmt 0)

10+ Year Member



Hi all,

Could you please have a look at this code and let me know if the starred part is ok or not? And if not any suggestions what I can do?
I think the code is obvious enough so I wouldn't describe any more! Just ask me any questions! I am desperate to find the reason of errors on my page!
Any help would be appreciated!

BR
Parisa

This is the code:

$locationquery = " SELECT user_site.site_id, site.Client, site.site_name FROM `user_site`, `site` WHERE user_site.user_name='$_SESSION[username]' and site.site_id = user_site.site_id" ;
$locationq = mysql_query($locationquery , $conn);

$locationdailycolorquery = " SELECT user_site.site_id , Count(*) Cnt
FROM `probe_kpi`,
`system_probe` ,
`system`,
`user_site`
WHERE probe_kpi.date = '$_SESSION[startdate]'
AND probe_kpi.kpi_id = 1
AND probe_kpi.probe_id = system_probe.probe_id
AND ((system_probe.system_id = system.system_id
AND system.site_id = user_site.site_id)
AND (user_site.user_name = '$_SESSION[username]'))
AND probe_kpi.kpi_colour = 'RED'
Group By user_site.site_id";

$locationdailycolor = mysql_query($locationdailycolorquery, $conn);

while ($row = mysql_fetch_array($locationq, MYSQL_NUM)) {
echo "<tr align=\"left\" valign=\"middle\">";
echo "<td>".$row[1]."</td>";
echo "<td height=\"100%\">&nbsp;</td>";
echo '<td nowrap valign=\"top\"><a href=systems.php?site=' . $row[0] . '>' . $row[2] . "</a></td>";
echo "<td height=\"100%\">&nbsp;</td>";
$row1 = Mysql_fetch_array($locationdailycolor, MYSQL_NUM);
***if ($row1[$row[0]][1]>0) *** {
echo "<div id=\"MyLayer\" style=\"position:absolute; width:229px; height:62px; z-index:1; left: 43px; top: 46px; display:none\"></div>";
echo "<td nowrap valign=\"middle\"><a onClick=\"javascript:Show('Your text goes here! ');\" href=\"#\"><img src=\"images/red.bmp\" border='0'></a>";

}
.
.
.

appi2

7:19 am on Sep 7, 2005 (gmt 0)

10+ Year Member



($row1[$row[0] ] <-- eh? --> [1]>0)

parisa

7:43 am on Sep 7, 2005 (gmt 0)

10+ Year Member



actually I want the count fir that site_id!
If you pay attention to the queries you can get what I mean!

mcibor

9:20 am on Sep 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Actually Appi is right!

mysql_fetch_array gives you an array, not array array.

Change the if to
//***
if ($row1[$row[0]] > 0)
{

And it should be ok.

In the code you wrote you checked:
$a = $row1[$row[0]];

if ($a[1]] > 0) {
And why should it be sth else than 0 if it's not defined?

Hope this explaines things a bit

Best regards
Michal Cibor

parisa

9:54 am on Sep 7, 2005 (gmt 0)

10+ Year Member



Yeah!
I think I got it.
Thanx
BR