sql query give error

Hello,



i want to give sql query like this but when i write php code in render sql like “’”.$head."’" then it give me error and doen’t show me the records



can u please tell me wht i do pleas4e see the else part of query and show me the actual query so i will show the data





                        







$sql = mysql_query(“SELECT headName from dummyHead WHERE projID=’”.$_REQUEST[‘projid’]."’ GROUP BY headName");

                            echo $countDummy = mysql_num_rows($sql);

                            if($countDummy<=0)

                             {

    

    $grid->render_sql(“select * from shot,shotTaskArtist where shotTaskArtist.projID=shot.projID and shot.projID=’”.$_REQUEST[‘projid’]."’ and shotTaskArtist.shotID_new=shot.shotID order by shot.shotID asc",“shot_task_id”,“checkEfficiency,overDue,difficulty,shotID_new,shotStatus,taskID,TaskREF,task_note,manDays,userID,taskStatus,startDate,endDate,task_priority,actualMandays,supervisorName”);

    

    

    }

     else {     

    

                         $head = “”;

                            while($rows = mysql_fetch_array($sql)) {

                            $head = $rows[‘headName’];

                            

                            }

    

         $grid->render_sql(“select * from shot,shotTaskArtist where shotTaskArtist.projID=shot.projID and shot.projID=’”.$_REQUEST[‘projid’]."’ and shotTaskArtist.shotID_new=shot.shotID order by shot.shotID asc",“shot_task_id”,“checkEfficiency,overDue,difficulty,shotID_new,shotStatus,taskID,TaskREF,task_note,manDays,userID,taskStatus,startDate,endDate,task_priority,actualMandays,supervisorName,’”.$head."’");

     }





regards

Suraj

a) The $head must be a comma separated list, but in your case it just the last fetched value
b) You need not use single commas in the command, just use
,supervisorName,".$head.");