[prev in list] [next in list] [prev in thread] [next in thread]
List: mysql
Subject: [Fwd: Phantom Row]
From: Van <vanboers () server ! dedserius ! com>
Date: 1999-08-04 3:49:59
[Download RAW message or body]
Sorry, right after I sent to mysql@tcx.se I received the new e-mail,
and, really need to resolv this, so, if you get a double-post, sorry.
Van
Van wrote:
>
> I do my checking in a php3-mysql 3.22.24 database, and, I'm starting to
> get corruption problems. I've been dinking with this for over an hour
> and a half and figure, that was enough.
> The table layouts are thus:
> mysql> describe checking;
> +-------------+--------------+------+-----+------------+----------------+
> | Field | Type | Null | Key | Default | Extra
> |
> +-------------+--------------+------+-----+------------+----------------+
> | id | int(10) | | PRI | 0 | auto_increment
> |
> | date | date | | MUL | 0000-00-00 |
> |
> | description | varchar(255) | YES | | NULL |
> |
> | debit | float(10,2) | YES | | NULL |
> |
> | credit | float(10,2) | YES | | NULL |
> |
> | checkno | int(11) | YES | | NULL |
> |
> +-------------+--------------+------+-----+------------+----------------+
> 6 rows in set (0.00 sec)
>
> mysql> select count(*) from checking;
> +----------+
> | count(*) |
> +----------+
> | 380 |
> +----------+
> 1 row in set (0.00 sec)
> My application says:
> <?php
> $Result = mysql_db_query($db, "SELECT * FROM checking");
>
> while( $row = mysql_fetch_array($Result) ) {
> if ( $row[credit] <> 0 ) {
> $tmp_Credit = $row[credit] + $tmp_Credit;
> $tmp_Add_Credit_Cnt = $tmp_Add_Credit_Cnt + 1;
> }
> if ( $row[debit] <> 0 ) {
> $tmp_Add_Debit_Cnt = $tmp_Add_Debit_Cnt + 1;
> $tmp_Debit = $row[debit] + $tmp_Debit;
> }
> }
>
> $Add_Credit = number_format( $tmp_Credit, "2", ".", "," );
> $Add_Credit_Cnt = $tmp_Add_Credit_Cnt;
> $Add_Debit = number_format( $tmp_Debit, "2", ".", "," );
> $Add_Debit_Cnt = $tmp_Add_Debit_Cnt;
> mysql_free_result($result);
> $Cur_Bal = number_format( $tmp_Credit - $tmp_Debit, "2", ".", ","
> );
> ?>
>
> And, returns:
> Account Count Debits Count Credits Sum Debits Sum Credits Balance
> Checking 329 50 $24,631.08 $25,799.99 $1,168.91
>
> In other words 1 less checking record than shows in the select count(*)
> query.
>
> Well, this one minor irritation is causing problems (and, I believe it's
> a corrupted record, but, I'm not able to isolate it), since when I add a
> new record, then do an isamchk -eR1,R2 .../checking, I get a table
> corrupted beyond recognition error. isamchk -r recovers it, but
> truncates the records. I've tried replicating the table in a new dbase,
> select into outfile checking.txt, then, load data infile checking.txt,
> and, things work great first out of the gate, but, all flies south after
> adding a new record, then, isamchk -eR1,R2 and I get the "gee you're
> database looks pretty messed up, dude" error, once again. I've been
> through this 7 times on two different servers.
>
> Ie., I've replicated the dbase across to another server and, found the
> same behavior (the web-app in php3 coexists on both, since my
> workstation is the mirror for my live server) on it. In other words,
> mysql command line shows 380 records, and, my while result script shows
> 1 less.
>
> I've got a garbage record in here, and, am looking for a tip on
> isolating it.
>
> Unless someone with more detached eyes, can see something I'm blatantly
> waxing incompetent on.
>
> Meantime, I'll pull it all into StarOffice Calc to import and than load
> data infile after clearing the table again, and, perhaps that will show
> up the villain. It would be very helpful however, to be able to script
> this out, and check for it periodically.
>
> Hope someone can offer a clue.
>
> Regards,
> Van
>
> --
> =========================================================================
> Linux rocks!!! http://www.dedserius.com
> =========================================================================
--
=========================================================================
Linux rocks!!! http://www.dedserius.com
=========================================================================
---------------------------------------------------------------------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail mysql-thread9288@lists.mysql.com
To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail mysql-unsubscribe@lists.mysql.com instead.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic