Jump to content

Data not refreshing on page


mdub2112

Recommended Posts

First off - NEWBIE here
So, where can I find that newbie help forum??

Now, this is all running on a lamp server
I've tested w\ both IE and FF and results are same

Writer uploads a file (to folder) gives it a title and places it in a category
Then publishes the, oh I'll call it a post

The dbase holds column names of sop, category (or these are the ones I'm havin' trouble with)
Everything seemed to be working fine

Output was expected

[b]Category 1[/b]
  Test 1 Cat 1
[b]Category 2[/b]
  Test 1 Cat 2
[b]Category 3[/b]
  Test 1 Cat 3

Then I tested the whole thing by adding another 'post' in to a couple of the categories
I was hoping for

[b]Category 1[/b]
  Test 1 Cat 1
  Test 2 Cat 1
[b]Category 2[/b]
  Test 1 Cat 2
  Test 2 Cat 2
[b]Category 3[/b]
  Test 1 Cat 3
  Test 2 Cat 3

It seems that either the category is not showing the newly added "Test 2 Cat #" or it is kicking out the "Test 1 Cat #" and replacing it with "Test 2 Cat #  Such as

[b]Category 1[/b]
  Test 2 Cat 1
[b]Category 2[/b]
  Test 2 Cat 2
[b]Category 3[/b]
  Test 1 Cat 3


Not sure what info you might need other than the code I'm using

<?php
  include_once('db_grab.php');

  $handle = db_connect();

  $categories_sql = 'select * from categories order by code';
  $categories_result = $handle->query($categories_sql);
 
  while ($categories = $categories_result->fetch_assoc())
  {
    $sop_sql = "select * from sops
                  where category = '{$categories['code']}'
                  and published is not null
                  order by published desc";
 
    $sop_result = $handle->query($sop_sql);
   
    if ($sop_result->num_rows)
    {
      $sop = $sop_result->fetch_assoc();
      echo "<p class='head'>{$categories['description']}</p>
              <p><a href='{$sop['pdf_file']}' target='_blank'>
                {$sop['title']}
                </a>
              </p>";
}
  }
?>


If I change the $sop_sql query to order by title asc (to which I'd prefer) then all categories simply revert back to the first postings
Any help greatly appreciated
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.