----- Original Message ----- 
From: "B Wiley Snyder" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 26, 2004 1:56 AM
Subject: mySQL beginner question


> Hello, hope this is the right list....
>
> I created a table with the following code
>
>
> CREATE TABLE jspCart_products (
> ProductID int primary key,
> CategoryID int,
> ModelNumber varChar(75),
> ModelName varChar(250),
> ProductImage varchar(250),
> UnitCost decimal(9,2),
> Description BLOB,
> );
>
> The CategoryID has duplicate entrys. When I use SELECT * FROM <mydatabase>
> I see the categories just fine but when they are sent to an html page they
> are null values. Would that be a screw-up in my code or is it becuase I
> need to specify when I initially build the table like above that it uses
> duplicates? i hope that makes sense and thanks for replys in advance.
>
It's not clear to me what you are saying when you say that CategoryID has
duplicate entries. Do you mean that you have this in your table:

ProductID    CategoryID    ModelNumber    ModelName    ProductImage
UnitCost    Description
1                1                  B200                Starburst
blahblahblah            50.00    x'...'
2                1                  C240                Stonehenge
foofoofoofoo            30.00    x'...'

i.e. products that have different product numbers have the same category ID?
If so, is that what you want in your table? It seems perfectly reasonable to
me to have this situation in your table.

When you say that the CategoryID is appearing as a null in your HTML
reports, do you mean that they are not null in the tables? If that is the
case, then it is almost certainly something in your code isn't handling the
values in the CategoryID column correctly. You may want to post the code
that reads the rows of the tables and formats it for the HTML page if you
can't find the problem yourself.

To be absolutely sure that the nulls being displayed by the program are
bogus, run this query from your command line:

select ProductID, CategoryID
from yourtable
where CategoryID is null

If this query produces an empty result, you can be dead certain that your
program is turning non-null CategoryIDs into nulls. If this query produces a
non-empty result, check the HTML report and see if the rows containing null
CategoryIDs match exactly the rows that contain nulls in the command line
query; if they do, your application code is working perfectly and your table
data has nulls in the CategoryID.

Rhino




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to