Hi all I am experiencing the following error.

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean givenit refers to line 94 which is the while loop start point.

Thanks in advance

D

<?php

                $x=0;
                $remainder=0;
                $image_value = array();
                $partners_id = array();
                $description_value = array();
                $url_value= array();
                $image_filename_value = array();
                $case_study_id = array();
                $CaseStudyTitle = array();
                $active = array();
                $show_in_banner = array();
                while($row = mysql_fetch_array($result))
                       {

                           //echo $row{'web_customised_partners_id'};
                           $partners_id[]= $row['web_customised_partners_id'];
                           $image_value[] = $row['image_id'];
                           $image_filename_value[] = $row['image_filename'];
                           $description_value[] = $row['description'];
                           $url_value[] = $row['url'];
                           $case_study_id[] = $row['web_customised_partners_case_study_id'];
                           $CaseStudyTitle[] = $row['CaseStudyTitle'];
                           $active[] = $row['active'];
                           $show_in_banner[]=$row['show_in_banner'];
                       }

the $result variable should be an array, post the $result data please so we can see the problem.

Hi szabizs here is the complete code list

If you require any thing else let me know

Thanks in advance
D

<?php

class PAGE_LIST_CUSTOMISED_PARTNERS extends PAGE_LIST
{
    public function get_css()
    {
        ?>
            <style>
            #about_customised_partner{ width: 135%; height: auto;}
            #about_customised_partner .inner {padding: 20px 20px 20px 30px ;}
            #about_customised_partner  img {margin: 10px 20px 10px 20px; width: 100px; float:left; border: none;}
            .partner_image { float:left;}
            .clear{clear: both;}
            .partner_description {display: none; background-color: #fff;  border:0px lightgrey solid; width:100%;clear:both; }
             .about_customised_partner   {padding: 10px; color: #666; -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; border: 1px solid #b4b4b4; background: #fff url(/media/library/sprite.png) no-repeat -1px -161px;}
            .content a {color: #AA2327; border:none; text-decoration: underline;}
            .selected {border:10px solid #AA2327;}
            .customised_accreditation p {}
            </style>
        <?php
    }

        public function get_js(){
        ?>

        <script type="text/javascript">
            $(document).ready(function(){
               $('.partner_image').click(function() {
                    var id = $(this).attr('id');
                    id = id.replace('partner_','');
                    console.log(id);

                    $('.partner_description').hide();

                    var description = $('#partner_description_' + id);
                    $(description).show();
                });

            });

        </script>
<?php
    }

    public function get_html(PAGE $page){

        $host="localhost";
        $username="root";
        $password="";
        $db_name="asdan_uk";


        mysql_connect("$host", "$username", "$password")or die("cannot connect to server");
        mysql_select_db("$db_name")or die("cannot select db");

        $sql = "SELECT
        web_customised_partners.image_id,
        web_customised_partners.web_customised_partners_id,
        description,
        url,
        web_images.image_id,
        web_images.image_filename,
        web_customised_partners_case_study_id,
        web_case_study.CaseStudyTitle,
        active,
        show_in_banner
            FROM
        web_customised_partners
            LEFT JOIN
        web_customised_partners_case_study ON web_customised_partners.web_customised_partners_id = web_customised_partners_case_study_id // fix this join
            LEFT JOIN
        web_case_study ON web_customised_partners_case_study.web_customised_partners_case_study_id = web_case_study.CaseStudyID
            LEFT JOIN
        web_images ON web_images.image_id = web_customised_partners.image_id";
        $result=mysql_query($sql);

        ?>
     <div class="content">
        <div id="about_customised_partner">
            <div class="inner">
                <h1>Customised accreditation</h1>
                <?php

                $x=0;
                $remainder=0;
                $image_value = array();
                $partners_id = array();
                $description_value = array();
                $url_value= array();
                $image_filename_value = array();
                $case_study_id = array();
                $CaseStudyTitle = array();
                $active = array();
                $show_in_banner = array();
                while($row = mysql_fetch_array($result))
                       {

                           //echo $row{'web_customised_partners_id'};
                           $partners_id[]= $row['web_customised_partners_id'];
                           $image_value[] = $row['image_id'];
                           $image_filename_value[] = $row['image_filename'];
                           $description_value[] = $row['description'];
                           $url_value[] = $row['url'];
                           $case_study_id[] = $row['web_customised_partners_case_study_id'];
                           $CaseStudyTitle[] = $row['CaseStudyTitle'];
                           $active[] = $row['active'];
                           $show_in_banner[]=$row['show_in_banner'];
                       }

                $index=0;
                function partnerDescription($partner, $description, $url, $case_study_id, $CaseStudyTitle)
                {
                    $result  = "<div class='partner_description' id='partner_description_{$partner}'>";
                    $result .= "<p class='about_customised_partner'>{$description}<br /><br />";
                    $result .= "<a href='http://{$url}' target='blank'>{$url} </a><br /><br /><a href='/About_ASDAN/Case_Studies/".$case_study_id."'> {$CaseStudyTitle}</a></p>";
                    $result .= "</div>";
                    return $result;
                }

                    foreach ($image_value AS $index => $image_values)
                        {

                            echo "<div class='partner_image ' id='partner_" .$partners_id[$index]. "'>";
                            echo "<a href='#' class='show_hide' rel='#slidingDiv'><img src ='/media/library/". $image_filename_value[$index]."' ></a>";
                            echo "</div>";
                            $x++;
                            $remainder = $x % 5;
                                if ($remainder ==0 )
                                    {
                                        echo "<div class='clear'><!----></div>";
                                    }
                                if ($x >4 )
                                    {
                                       for ($i=$index-4; $i<=$index; $i++)
                                           {
                                               echo partnerDescription($partners_id[$i], $description_value[$i], $url_value[$i], $case_study_id[$i], $CaseStudyTitle[$i]);

                                           }
                                        echo "<div class='clear'><!----></div>";// clear div after every 5 iterations

                                     $x=0;// reset iteration
                                    }

                            }// end of for loop

                    if($remainder !=0)

                    {
                        for ($i=$index-$x+1; $i<=$index; $i++)
                        {
                            echo partnerDescription($partners_id[$i], $description_value[$i], $url_value[$i], $case_study_id[$i], $CaseStudyTitle[$i]);

                        }
                    }
              ?>
            </div>
         </div>
      </div>
    <?php
    }
}

First confirm whether the sql query is really being executed, coz it seems to me that the sql query may not be executing.

You could start by checking whether the query is being executed by adding an if condition ...

Perhaps this code may give you a clue;

$result = mysql_query($sql);

if($result === FALSE) {
    die(mysql_error()); // Display a more meaningful error
}

while($row = mysql_fetch_array($result))
{
    echo $row['FirstName'];
}

I don't think // is a valid mysql comment as you use at line 70:

web_customised_partners_case_study ON web_customised_partners.web_customised_partners_id = web_customised_partners_case_study_id // fix this join

Hi webville thanks for the feed back

Thanks for the above code which helped and I echoed out the SQL and it displayed this in it (// fix this join) on line 70,I left it here as a reminder repair join
sorry for the silly mistake.

Thanks

D

Hi webville thanks for the feed back

Pzuurveen noticed that as i did the below

Thanks for the above code which helped and I echoed out the SQL and it displayed this in it (// fix this join) on line 70,I left it here as a reminder repair join
sorry for the silly mistake.

Thanks

D