This topic is locked

Making Search by category list update

4/24/2008 6:29:43 AM
PHPRunner General questions
N
nadimo author

Hello,
I was wondering if any one knows how to refresh / update a Search by category list .
Let me explain :
I added to a database some records ..and when loading the page I get :
Search by category
Access (14)

Algorithms and procedures (1)

Animation (2)

Applied Mathematics (1)

etc......
Now if I add more data to the database for the above categories .. and i reload the page (after cleaning the browser cache ..etc)
I still get the same number of hits , Access (14) ... Animation (2) .. etc .
What am I missing What should I do to make the list display the new information ?
any clues please ?
Thanks in advance.
nadimo.

N
nadimo author 4/24/2008

OOPs.. Forgot .. 2 more things :

  1. am not adding the new records from the web browser, but from MyPhpAdmin directly through an SQL Query .
  2. Here is the code I am using to display the "Search by category list"" (I took it from one of the template it understood its logic and modified it to suit my DB :
    global $strSQL,

    //** Custom code ****

    // put your custom code here
    $conn,$strTableName;

    echo "
    <b>Search by category</b>
    ";

    echo "

";

//categories

$str = "select count(category) as numbers, Category from ".$strTableName." group by Category";

$rs = db_query($str,$conn);

while ($data = db_fetch_array($rs))

{

$category = str_replace(" ","+",$data["Category"]);

$message = "<a style=\"color: black;\" href=\"booklibrary_list.php?a=search&value=1&SearchFor=".$category."&SearchOption=Contains&SearchField=Category\">".$data["Category"]." (".$data["numbers"].")</a>
";

echo $message;

}
Hope some one can help.
thanks .

nadimo.

S
spintz 4/24/2008

Could be a caching issue. In case it is, I recommend adding these lines to dbcommon.php -

header( "Expires: Mon, 20 Dec 1998 01:00:00 GMT" );

header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );

header( "Cache-Control: no-cache, must-revalidate" );

header( "Pragma: no-cache" );
N
nadimo author 4/24/2008

Could be a caching issue. In case it is, I recommend adding these lines to dbcommon.php -


header( "Expires: Mon, 20 Dec 1998 01:00:00 GMT" );

header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );

header( "Cache-Control: no-cache, must-revalidate" );

header( "Pragma: no-cache" );


Hi,
Thanks for trying to help , but it did not work .

I added the code inside dbcommon.php after :
header("Content-type: text/html;
charset=".$cCharset);
also tried at start after : <?php, no luck .
It is so frustrating .
what next <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=28490&image=1&table=forumreplies' class='bbc_emoticon' alt=':(' />
nadimo

N
nadimo author 4/24/2008

I have updated the Cars database from outside the web browser (I am talking about the cars template example ).and going back to see if the category list is updated . It is indeed .So I guess there is something missing in my code . I paste below the cars php file that displaus the categories list , maybe some PHP guru can figure out what is missing in my code .:
global $strSQL,$conn, $smarty;
//search by brand

$message="<b>Search by Brand
";
$str = "select count(Model) as numbers, Make from cars group by Make";

$rs = db_query($str,$conn);

while ($data = db_fetch_array($rs))

{

$make = str_replace(" ","+",$data["Make"]);

$message = $message ."<a href=\"cars_list.php?a=search&value=1&SearchFor=".$make."&SearchOption=Contains&SearchField=Make\">".$data["Make"]." (".$data["numbers"].")</a>";

$message = $message ."
";

}
//show all

$message = $message ."
<a href=\"cars_list.php?a=showall&value=1&SearchFor=&SearchOption=&SearchField=\">show all</a>

";.........
thanks for any help.

nadimo.

J
Jane 4/25/2008

Hi,
your code looks good.
Please publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with instructions on reproducing this error.

I'll find what's wrong with your project inspecting it at Demo account site.

N
nadimo author 4/25/2008

Hi,
I fixed the problem , I replaced
"&SearchOption=Contains&SearchField=Category
with "&SearchOption=Equals&SearchField=Category
and the category list is now ok when clicked at .
thanks for your kind help.

nadimo.