Godzilla wrote:

Hi everyone,

I have a pretty strange problem that may be simple, but I have never heard
of it.

//////        I have a database in the following format:

2
2
2
Cd's
Cd's
DVD's
DVD's
DVD's
DVD's
DVD's

//////     Someone recently helped me out in writing a short script that
would turn it into this:

2   1 \\ each unique entry gets a unique number separated by Tabs
2   1
2   1
Cd's    2
Cd's    2
DVD's   3
DVD's   3
DVD's   3
DVD's   3
DVD's   3

Here is the script
--------------
$count = 0;
$db = mysql_connect("localhost", "user", "pass");
mysql_select_db("database",$db);
$result = mysql_query ("SELECT * FROM `data` WHERE categories");

try changing this query to

"SELECT * FROM `data` WHERE categories != '' OR categories IS NOT NULL"

while ($row = mysql_fetch_array($result)) {
$currow = $row["0"];
if ($count == 0) {
$lastrow = $currow;
$count = 1;
}
echo $row["0"] . "\t" . $count . "<BR>\n";
if ($currow != $lastrow) {
$count++;
} $lastrow = $currow;
}
--------------
This worked great on my home server. Now I need to move it over to our real
server which has an almost identical setup. The problem I have is that it
will only print rows that begin with a number! I have tried changing the
dbase format to just about everything, but still no good.
The table has about 4000 rows but the script only prints the first 300 or so
which are the ones that begin with a number. I have tried removing all of
the rows that start with a number, in that case it prints nothing, acting
like the other row's don't exist. My home server has since been formatted so
I can't verify what the setup was or if there was anything different about
it.
If anyone can help in any way it would be greatly appreciated, I am on a
deadline which ends in a few days and this is putting me behind schedule.

Thanks Very Much,Tim






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to