Skip to main content
January 12, 2010
Question

read entry from 2 different recordsets

  • January 12, 2010
  • 1 reply
  • 683 views

I have 2 recordset. $row_rsArtist has all the artists (id, nameArtist) $row_rsProject has the projects (id, cat_id, nameProject).

To link the artist to a specific project I put $row_rsArtist['cat_id'] the same number as $row_rsProject['id'] .

Now I need to read the name of the Artist in my list of Projects, but I don't know how to do this!!?

<?php do { ?>
<a href="fotos.php?v=<?php echo $row_rsProject['cat_id']; ?>">HERE SHOULD BE the name of the Artist from rsArtist [nameArtist]</a><br />
<?php } while ($row_rsProject = mysql_fetch_assoc($rsProject)); ?>

Thank you for any help.

This topic has been closed for replies.

1 reply

Participating Frequently
January 12, 2010

Do you need two recordsets? Why can't you use a single recordset with data from both tables?

January 12, 2010

I don't know how to do that... ?

January 12, 2010

>I don't know. I am working a lot with Dreamweaver

>functions.. so I don't have to write to much in the code.

OK, if you are working with a data driven site you need to learn SQL. There's no way around it. The built in DW widgets can only get you so far.

Start here: http://www.w3schools.com/sql/default.asp and read about joins. You can also use DW's advanced recordset GUI to build it for you, but I really think you are doing yourself a disservice if you don't learn SQL basics. How did the database get designed?


I am learning, so I do step by step. Now I encounter this problem I hope to learn this 'joining'. Until now I could go around that or without needing this. THank you for the TIP! I will look at the tutorials.