Jump to content

Declaring results as a variable


MDanz

Recommended Posts

For my search engine the results are echoed into a table.

 

The best way i can think of doing this.  Is declaring the results as a variable.  So then i can input the results into an array and do this

 

$stack= array($results);

array_push($stack, $results);

echo($stack);

so i get to display my old results with my new one

 

how do i declare my results as a variable though...

 

echo '<br><table '.$margin.'>';

 

      while ($runrows = mysql_fetch_assoc($run))

    {

              //get data

        $name = $runrows['name'];

        $image = $runrows['image'];

        $hyperlink = $runrows['hyperlink'];

        $currency = $runrows['currency'];

        $info = $runrows['info'];

        $type = $runrows['type'];

 

 

        echo '<tr><td>';

switch ($type) {

    case 'I':

        echo '<img src="http://www.u-stack.com/Image.jpg">';

        break;

    case 'M':

        echo '<img src="http://www.u-stack.com/Music.jpg">';

        break;

    case 'F':

        echo '<img src="http://www.u-stack.com/File.jpg">';

        break;

    case 'V':

        echo '<img src="http://www.u-stack.com/Video.jpg">';

        break;

        case 'J':

        echo '<img src="http://www.u-stack.com/Job.jpg">';

        break;

        case 'D':

        echo '<img src="http://www.u-stack.com/Discussion.jpg">';

        break;

        case 'P':

        echo '<img src="http://www.u-stack.com/Product.jpg">';

        break;

 

 

 

}  echo '</td></tr>';

 

 

 

    }

 

   

    echo '</table>';

 

 

 

}

 

how do i declare all of that as a variable?... like $results

Link to comment
https://forums.phpfreaks.com/topic/169176-declaring-results-as-a-variable/
Share on other sites

$results = <<<ANYTHINGYOUWANTSRSLY//this has to match up exactly at the end
Multiple Lines
And other stuff
Like quotes and html and tables
WHeeeeeee!
ANYTHINGYOUWANTSRSLY;//this matches exactly with the beginning

echo $results;

 

I believe I've answered this thread 8-)

 

~kratsg

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.