I have a simple query:

$query = "SELECT
Item_Name, Item_wiki, Item_Website
FROM
items_list";

$result = mysql_query($query, $db) or die(mysql_error($db));
// loop through the results
while ($row = mysql_fetch_assoc($result)) {
extract($row);

I want to put another query inside it. I have a second table (item_clip) that holds the photos for each Item_Name. It's fields are clip_name, clip_photos.
items_list.Item_Name=item_clip.clip_name

How do I identify how many rows of photos the second table has for each entry in my first table?

(many thanks in advance from a humble nube)

Well I worked out my problem... I was perusing down the SQL forum and a guy asks about having two databases going at once. Well that's what I've done; I've nested one open database in another:

$db2 = mysql_connect...
$query2 = "SELECT...
$result2 = mysql_query($query2, $db2) or die(mysql_error($db2));
$num_clips = mysql_num_rows($result2);

and then connected both tables with:

WHERE
clip_name ='$Item_Name'

The more I study PHP/Mysql, the more I realise how thick I am :-(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.