View Single Post
Old 01-08-2008, 01:12 AM   #1 (permalink)
Andrew
The Acquainted
 
Join Date: Sep 2007
Location: Arizona
Posts: 114
Thanks: 10
Andrew is on a distinguished road
Default Outputting MySQL Results

I just spent a good 20 minutes writing this out, before I realized I'm not explaining it well, nor will all the info I need help with fit on this page. If any of you who are PHP 'gurus' would be willing to hire yourself out for an hour to help me with some questions/problems I'm having, that would be much appreciated. I've probably spent several hours trying to get this to work, using a multitude of different methods, rewriting my code a full two times, and still have gotten no where. That isn't even counting the time I've spent just LOOKING for ways it can be done.

If you would like to read what I started to write, here it is:

Sorry I couldn't think of a better title, but it suffices.

Here is my problem. I'm currently coding a wallpaper script for a multitude of reasons. A few of which being it would help me further my schools by implementing some things I've never used before, developing it for my own site and another persons. I'm trying to make it easy to integrate into, so I'm using "WordPress-like" output techniques (such as $settings->info('url')), and I'm running into trouble actually outputting the data in an easy way.

Now, I've seeked advice from Dread (whom of which Salathe and Wildhoney know) and he told me the way he would store database results, instead of using the results from mysql_fetch_array(), was to run a while loop, and put all the results into an array. It has been going great, but I've ran into a few problems.

The first being, that I have to use a foreach() loop in my site to go through the array and fill in the results. Problem being, the foreach() loop requires an "AS" clause, and I have it, but I'm not using it at all (though I might have to globalize it to make sure I'm getting the right result). Here is my code for my output:
PHP Code:
<?php foreach ($wp->in_category(1) as $wall): ?>
                <div class="wallpaper">
                    <img src="<?php $wp->get_option('thumb_url'); ?>" alt="<?php $wp->get_option('title_attr'); ?>" />
                    <a href="<?php $wp->get_option('view_url'); ?>" title="<?php $wp->get_option('title_attr'); ?>"><?php $wp->get_option('name'); ?></a>
                    <a href="<?php $wp->get_option('download_url'); ?>" title="Download <?php $wp->get_option('title_attr'); ?>" class="download">download this now!</a>
                </div>
            <?php endforeach; ?>
The problem I'm running into this, is that for some STRANGE reason, only the 4th and 2nd data entries in the database properly come out when I'm using a pagination script.
Send a message via AIM to Andrew Send a message via MSN to Andrew
Andrew is offline  
Reply With Quote