Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder olidenia's Avatar
    Join Date
    Oct 2009
    Location
    Sitting In Front Of A Screen
    Posts
    110
    Thanks
    16
    Thanked 4 Times in 4 Posts

    Doing a while statement inside a javascript problem

    Hi to all!

    I'm having some problems with the following script:

    I need to do a while statement inside a javascript tooltip, but it's giving problems and it's not working, what am I doing wrong???

    PHP Code:
                                $result_events mysql_query("SELECT * FROM `dnl_events` WHERE date='$year-$fmonth-$startdate'");
                                
    $output .= "<td id=\"$year"."-"."$fmonth"."-"."$fstartdate\" width=$width valign=top align=center onclick=\"calendar_date('$year"."-"."$fmonth"."-"."$fstartdate','$js_status','$username','e7e7e7');\" bgcolor=\"#$status_color\">

                                <table width=\"100%\" cellpadding=2 cellspacing=0 border=0><tr><td align=center>

                                <span class=\"calendar_date_number$small\"><a id=\"cal_links\" href=\"events.php?d=$startdate&m=$fmonth&y=$year\" onMouseover=\"ddrivetip('"
    .while($row_event mysql_fetch_array($result_events)){echo"$row_event[title]<br>";}."')\";
     onMouseout=\"hideddrivetip()\">$startdate</a></span>

                                </td></tr></table></td>"

    Last edited by olidenia; 11-12-2011 at 01:30 PM.
    It's easy once you know how...

  • #2
    Regular Coder
    Join Date
    Oct 2009
    Posts
    432
    Thanks
    6
    Thanked 3 Times in 3 Posts
    ok first thing to do here is check that there are results to use in the while statement.

    change your code to this, (i have added one line just after your query line)
    PHP Code:
                                $result_events mysql_query("SELECT * FROM `dnl_events` WHERE date='$year-$fmonth-$startdate'");
                                echo(
    ":".mysql_num_rows($result_events).":"); exit; // this line echo's the number of results found in the previous line and then stops the page from continuing with exit;
                                
    $output .= "<td id=\"$year"."-"."$fmonth"."-"."$fstartdate\" width=$width valign=top align=center onclick=\"calendar_date('$year"."-"."$fmonth"."-"."$fstartdate','$js_status','$username','e7e7e7');\" bgcolor=\"#$status_color\">

                                <table width=\"100%\" cellpadding=2 cellspacing=0 border=0><tr><td align=center>

                                <span class=\"calendar_date_number$small\"><a id=\"cal_links\" href=\"events.php?d=$startdate&m=$fmonth&y=$year\" onMouseover=\"ddrivetip('"
    .while($row_event mysql_fetch_array($result_events)){echo"$row_event[title]<br>";}."')\";
     onMouseout=\"hideddrivetip()\">$startdate</a></span>

                                </td></tr></table></td>"

    let us know what number is between the :: displayed.
    Last edited by Inigoesdr; 11-13-2011 at 03:33 AM.

  • #3
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    Additionally, post the current output and any errors you get.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •