Announcement

Collapse
No announcement yet.

sc_lookup with more than 1 line of data? should i use foreach?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • sc_lookup with more than 1 line of data? should i use foreach?

    hi, how we can get more than one line in mysql query using sc_lookup?

    example

    Code:
     
    sc_lookup(dataset, "SELECT count(id), user FROM table WHERE...etc");
    Now i have 5 lines as results like
    {field}={dataset[0][0]}.' user '.{dataset[0][1]}; through {dataset[5][1]}...

    I want to have this:
    {field}={dataset[0][0]}.' user '.{dataset[0][1]} .'<br>'.
    {dataset[1][0]}.' user '.{dataset[1][1]}; .'<br>'.
    {dataset[2][0]}.' user '.{dataset[2][1]}; .'<br>'.
    {dataset[3][0]}.' user '.{dataset[3][1]}; .'<br>'.
    {dataset[4][0]}.' user '.{dataset[4][1]}; .'<br>'.;

    without having to write all that, should i use foreach? and how?

  • #2
    Code:
    {field} = '';
    foreach($dataset as $row)
    {
        {field} .= $row[0].' user '.$row[1].'<br>';
    }

    jsb

    Comment


    • #3
      Originally posted by jsbinca View Post
      Code:
      {field} = '';
      foreach($dataset as $row)
      {
          {field} .= $row[0].' user '.$row[1].'<br>';
      }

      jsb
      Merci Monsieur
      thats exactly what was needed
      cheers

      Comment

      Working...
      X