Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Do you need two recordsets? Why can't you use a single recordset with data from both tables?
Copy link to clipboard
Copied
I don't know how to do that... ?
Copy link to clipboard
Copied
>I don't know how to do that... ?
I mean create a recordset with SQL that joins the two tables. You know how to do that, right?
Copy link to clipboard
Copied
I don't know. I am working a lot with Dreamweaver functions.. so I don't have to write to much in the code.
How could I join this 2 recordset?
mysql_select_db($database_connDNA, $connDNA);
$query_rsArtist = "SELECT * FROM ul_fotos WHERE voorstelling = 'Medewerkers' ORDER BY volgorde DESC";
$rsArtist = mysql_query($query_rsArtist, $connDNA) or die(mysql_error());
$row_rsArtist = mysql_fetch_assoc($rsArtist);
$totalRows_rsArtist = mysql_num_rows($rsArtist);
mysql_select_db($database_connDNA, $connDNA);
$query_rsProject = "SELECT * FROM ul_content WHERE submenu = 'opleiding' ORDER BY volgorde DESC";
$rsProject = mysql_query($query_rsProject, $connDNA) or die(mysql_error());
$row_rsProject = mysql_fetch_assoc($rsProject);
$totalRows_rsProject = mysql_num_rows($rsProject);
Thanks a lot for helping me!:)
Copy link to clipboard
Copied
>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?
Copy link to clipboard
Copied
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.