0

Hi all ;
please help me what is the expected problem in this code ??!

function SearchGrid($query,$updateOk=FALSE,$DeleteOk=FALSE)
               {

             $tbl.="<script>
             var prev=1;
             function HighLightRow(rowno){
                if (rowno%2==0)
                tblsearch.rows[prev].bgcolor='#66FF99';
                else 
                tblsearch.rows[prev].bgcolor='#CCCC99';

                tblsearch.rows[rowno].bgcolor='white';
            prev=rowno;
             }
             </script> ";


                $result=mysql_query($query);
                $tbl.="<table id=tblsearch align =center border=0 > 
                <tr bgcolor=gray>";

                $RowNum =mysql_num_fields($result);
                //name of field :) .... 
                for($col=0;$col<$RowNum;$col++)

                $tbl.='\n <th font color=white>'.
                 mysql_field_name($result, $col).'</font></th>';
                //update/delete OK 
                $tbl.='\n </tr>';
                $rownow=1;
                while ($row =mysql_fetch_row($result)) { //fetch_row
                    $tbl.'<tr onmousemove=\"HighLightRow($rownow)\" bgcolor=#eehh99';
                    if ($rownow%2==0)
                    $tbl.="#669999>";
                    else 
                        $tbl.="#66CC99>";
                        $rownow++;
                for($col=0;$col<$RowNum;$col++)
                $tbl.='\n  <td> $row[$col] </td>';
                $tbl.='</tr>';
                }//while

                if(mysql_errno()==0)

                return $tbl.'</table>';
             else 
                 return "error".mysql_error();

               }//function

8f1682468bfa75dc21deca0505ce11f7

4
Contributors
8
Replies
33
Views
3 Years
Discussion Span
Last Post by iamthwee
1

Like what the hell is it supposed to do. Like what is the query you're passing in, sorry but incase you didn't get the memo we're not mind readers, I can't tell what sql you pass into the variable $query.

Like what the hell is the deal with that jpg you posted, how is it wrong, how is it right, what are you expecting.

^^common sense if you're expecting to get a useful reply right?

line 39 most probably needs to be using speech marks instead of single quotation marks...

Edited by iamthwee

1

Problem with line 39:
You have this: $tbl.='\n <td> $row[$col] </td>';
It should be this: $tbl.='\n <td> " . $row[$col] . " </td>';

0

im not expert in english ^_^ thanks for your advice "iamthwee"

1

Although, that may indeed solve your problem take a look at bob's advice too.

You want to be creating web compliant html, and I think that is what almostbob is rightly pointing out as being ineffective with your code in particular.

Edited by iamthwee

This question has already been answered. 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.