Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old September 1st, 2008, 03:58 PM
Familiar Sight
 
Join Date: Jun 2008
Posts: 132
Default query cache or something else mad

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.
Reply
  #2  
Old September 1st, 2008, 11:54 PM
Atli's Avatar
Moderator
 
Join Date: Nov 2006
Location: Iceland
Age: 22
Posts: 2,760
Default

Hi.

How exactly are you executing the queries to get this data?
Could we see the code?
It wold also help to see how the table is structured.
Reply
  #3  
Old September 2nd, 2008, 08:16 AM
Familiar Sight
 
Join Date: Jun 2008
Posts: 132
Default

[code=php]
<?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'] . '^';

}

?>
[/code]

The table is using myISAM and is as follows;
Code:
CREATE TABLE `tes`.`project` (
`proj_id` VARCHAR( 10 ) NOT NULL ,
`project_name` VARCHAR( 50 ) NOT NULL ,
`form` VARCHAR( 10 ) NOT NULL ,
`access` VARCHAR( 10 ) NOT NULL ,
`cable_entry` VARCHAR( 10 ) NOT NULL ,
`ip_rating` VARCHAR( 10 ) NOT NULL ,
`fault_rating` VARCHAR( 10 ) NOT NULL ,
`company_name` VARCHAR( 50 ) NOT NULL ,
`proj_manager` VARCHAR( 30 ) NOT NULL ,
`deadline` VARCHAR( 10 ) NOT NULL ,
PRIMARY KEY ( `proj_id` ) 
) ENGINE = MYISAM

Last edited by Atli; September 2nd, 2008 at 03:19 PM. Reason: Added [code] tags.
Reply
  #4  
Old September 2nd, 2008, 08:18 AM
Familiar Sight
 
Join Date: Jun 2008
Posts: 132
Default

and the output I get when I run this query as is;

Code:
4 
77 
1 
111 
78 
444 
222 
1004
This is a list of project id's that fit the criteria but each one has been deleted. Even if I delete the table these records still show.
Reply
  #5  
Old September 2nd, 2008, 08:55 AM
Expert
 
Join Date: Nov 2007
Location: Germany / Saudi Arabia
Posts: 209
Default

Quote:
Originally Posted by cleary1981
Even if I delete the table these records still show.
Maybe you forgot to "commit" and/or close the current connection after deleting the table. Then your program of course still sees the old data.

If not,then just figure out where the old data is cached.
After deleting the table and restarting the database, is it still there when inquiring again? Then it's cached somewhere inside your apache/php.
After deleting the table and restarting your apache/php, is it still there when inquiring again? Then it's cached somewhere inside the database.

After figuring that out, we can help you more.
Reply
  #6  
Old September 2nd, 2008, 10:15 AM
Familiar Sight
 
Join Date: Jun 2008
Posts: 132
Default

Silly me. I was working of the wrong table. The child table still had the proj_id fields in it. Duh!

Thanks anyway
Reply
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles