If I'm hearing you correctly, you've got two tables using the same  
primary key?
That means that all of the information could be placed in one table  
only..!

However, if there are many product images for one product, then  
product images should have its own primary key "id" or  
"product_images_id" and should merely reference "product_id" as a  
foreign key relationship...

But only if I'm hearing you correctly... ;-)

On 3/11/2008, at 10:40 PM, Michael wrote:

>
> Thank you to the people who posted solutions to the last question. :-)
>
> To expand on this, is it possible with MySQL to do the following-
>
> I have two tables, both with 'productid' as the primary field.
>
> I need retrieve a few fields from table 1, but I only need to know  
> if a line
> exists and has a BLOB size larger then 0, in table 2.
>
> (By way of explanation, table 1 has product information and table 2  
> has
> product images - both share the same primary field).
>
> If that line exists and with content I want to activate code within  
> a PHP 'if'
> statement, however I don't actually want to retrieve the field.
>
> And I'd like to do all of this in 1 SQL statement.
>
> Relevant fields within tables-
>
> table 1 (product info)
> - productid (int primary)
> - title_1 (varchar)
> - title_2 (varchar)
> - title_3 (varchar)
>
> table 2 (images)
> - productid (int primary)
> - pic (blob)
>
> >


--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[EMAIL PROTECTED]
-~----------~----~----~----~------~----~------~--~---

Reply via email to