Jump to content

Query cache


cleary1981

Recommended Posts

Hi,

 

Thought I would post this before I start to bang my head of the table.

 

I have a query that outputs an array from a table.The output is showing records that are no longer in the table. Even when i delete the table, these records still show. I am using php for my queries. How can I get rid of these annoying records. I think the problem may lie with query_cache but I could be wrong.

Link to comment
Share on other sites

heres my php script. When I run this directly in the browser (IE6 or Firefox) I get a list that contains records that have already been deleted.

 

<?php
require "config.php";

// array of all projects
$query1 = mysql_query("SELECT DISTINCT proj_id FROM object") or die(mysql_error());
while($all = mysql_fetch_array($query1)) {
$array1[] = $all['proj_id'];
}


// array of projects needing priced
$query2 = mysql_query("SELECT DISTINCT proj_id FROM object, module WHERE object.module_name = module.module_name AND confirmed = '0'") or die(mysql_error());
while($notPriced = mysql_fetch_array($query2)) {
$array2[] = $notPriced['proj_id'];
}

$diff = array_diff($array1, $array2);

while (list ($key, $val) = each ($diff)) {
echo "$val <br>";

//$q2 = mysql_query("SELECT project_name, company_name, proj_id FROM project WHERE proj_id = '$val'") or die(mysql_error());
//		$row = mysql_fetch_arrayS($q2);
//		echo $row['company_name'] . '$' . $row['project_name'] . '$' . $row['proj_id'] . '^';

} 

?>

 

heres the output I get even if the table is deleted these records will still show

4 
77 
1 
111 
78 
444 
222 
1004 

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.