Jump to content

stop looping


scmeeker

Recommended Posts

I want to list the contents of my table but I don't want it to keep repeating and I'm trying to stop the loop but seem to be missing something that perhaps a more experienced set of eyes can catch.  When I try, it will only show one record and stop but I want it to list them all and stop.

 

Any suggestions?  Thanks.

 

Here is the code:

 

$get_items_sql = "SELECT id, title, location, deadline, brief_description, date FROM list WHERE MONTH(date) = MONTH(CURDATE())";
            $get_items_res = mysqli_query($mysqli, $get_items_sql) or die(mysqli_error($mysqli));
            if (mysqli_num_rows($get_items_res) < 1)
            {
                $content = "<p><em>Sorry, no items in this category.</em></p>\n";
            }
            else
            {
                $content .= "<ul>\n";
                while ($items = mysqli_fetch_array($get_items_res))
                {
                    $item_url = "list_detail.php?id={$items['id']}";
                    $item_title = stripslashes($items['title']);
                    $item_location = $items['location'];
                    $item_deadline = $item_info['deadline'];
                $item_brief_description = $items['brief_description'];
                    $item_id = $items['id'];
                    $content .= "";

				$content .="<table width=\"693\ height=\"300\" border=\"0\"><tr><td width=\"200\"> <a href=\"{$item_url}\">
                    {$item_title}</a><td width=\"251\">{$item_location}</td>
                    <td width=\"109\">{$item_deadline}</td></tr><tr><td colspan=\"3\" valign=\"top\" class=\"blackfont\">{$item_brief_description}</td></tr></table>";
 $content .= "\n";
			}
			$content .= "</ul>\n";

Link to comment
Share on other sites

I fixed it.  Thanks.  In code that was just above the code that's shown (the next line above), there was a curly bracket that needed to be switched from open to closed and one had to be removed from the bottom. 

 

Thanks Pikachu for noticing my missing quote too. Got it fixed.  It's a lot of stress on the brain learning PHP!  I appreciate all your help you've given me.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.