multiple row values in single variable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chandru123
    New Member
    • Oct 2013
    • 1

    multiple row values in single variable

    i am adding all names in to single variable but it is showing only one value last one. any one knows solution for this.

    my code is :

    Code:
    include 'dbconnect.php';
    $result = mysql_query("SELECT * FROM bookedtates WHERE SID='$ServiceHosterIdv' AND BOOKEDDATE='$q'");
    //$result = mysql_query("SELECT * FROM bookedtates WHERE SID='$ServiceHosterIdv' AND BOOKEDDATE='$q'");
    
    while ($row = mysql_fetch_assoc($query)) {
    $csk = "'".$row['NAME']."',";
    }
    echo $csk;
    Last edited by Rabbit; Oct 4 '13, 03:13 PM. Reason: Please use [CODE] and [/CODE] tags when posting code or formatted data.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Please use code tags when posting code or formatted data.

    The problem is that you haven't appended the value to csk. You keep replacing it with a new value.

    Comment

    Working...