Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6620649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:07:45+00:00 2026-05-25T21:07:45+00:00

My php function looks like that function generateTour ($lang, $db) { echo ‘<table border=0

  • 0

My php function looks like that

function generateTour ($lang, $db)
{
    echo '<table border="0" cellpadding="0" cellspacing="0" width="100%">';
    $title='title_'.$lang;
    $txt='txt_'.$lang;
    $result = $db->query("SELECT id, $title, $txt FROM 1_table");
    $count= $result->num_rows;
    $i=1;
    while($row=$result->fetch_object())
    {
    if($i%3==0) echo '<tr>'; 
    echo '<td width="33%">
    <div class="tour_item" style="background-image:url(core/content/img/pages/1/slide/'.$row->id.'.png)">
    <div class="tour_item_title"><a href="?id='.$row->id.'">';
    echo '</a></div><div class="tour_item_text"><a href="?id='.$row->id.'"></div>
    </div>';
    if($i==$count-1) echo '</td></tr>'; 
    else if($i%3==0) echo '</td></tr><tr>'; 
    $i++;
}
    echo '</table>';
}

As you see it echoes result line by line. Not all at once. I want to collect all variables to one array and return this array. Is it possible? how to do it?

Please don’t post your ideas about security holes .. etc. I’m filtering $title, $txt varibales against sql injections. (i have array for of possible field names. My filter function checks theese variables’ values every time. )

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:07:45+00:00Added an answer on May 25, 2026 at 9:07 pm
    $data = array();
    while ($row = $result->fetchObject()) {
       $data[] = $row;
    }
    

    Is the absolutely most basic method of cacheing a result set in an array. You’d just modify this to store your generated html instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My PHP class looks like that. <?php class htmlize { protected $base_dir; public function
I have an an ajax request that looks like this, $('input.fakecheck').click(function(){ alert(deleteing....); $.ajax({ url:/search,
I have a PHP array that looks like this: Array ( [0] => Array
I have a function that looks like this class NSNode { function insertAfter(NSNode $node)
I am reading some code that looks like that: Class_Menu.php: <?php class Menu {
My db table looks like that. I'm trying to generate nav. menu from db
I have a PHP array that looks like this: [3] => Hello [7] =>
I have a table that looks like: +--------------------+-------------+------+-----+---------+-------+ | Field | Type | Null
My php code looks like that if (isset($_REQUEST['term'])) { $term = trim(strip_tags($_REQUEST['term']));//retrieve the search
My Jquery slideshow script looks like that $(function() { $('#bg').crossSlide({ sleep: 3, shuffle: true,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.