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

Member Avatar for iamthwee

Consider asking a smarter question.

like ?

Member Avatar for iamthwee

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...

19 is wrong
20 is wrong
26 is wrong
39 is wrong

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

thanks all :) solved ^_^

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

Member Avatar for iamthwee

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.

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.