Hello!
Please all consider that I'm new with PHP and MYSQL (and that I'm Dutch).
I'm working on a site where I want to embed information from two db-tables into one web-table.
I'm using three tables from my db: Users (UserID, Name, etc), Rubrics(RubricID,UserID,Rubricname) and Links(URLID,RubricID,URLname,URLadress).
When I'm logging in I want to see all my favorit links categorized in rubrics. So therefore I want to create a table for each rubric and that specific table must contain the links with the same RubricID.
I tried something like this:
......
result2 = mysql_query("SELECT * FROM Rubrics WHERE userID=1");
$result = mysql_query("SELECT * FROM links WHERE RubricID=1");
if ($myrow2 = mysql_fetch_array($result2)) {
do {
echo "<TABLE border=1>\n";
printf("<TR><TD>%s </TD></TR>\n", $myrow2["Rubricname"]);
if ($myrow = mysql_fetch_array($result)) {
do {
printf("<TR><TD>%s </TD></TR>\n", $myrow["URLname"]);
} while ($myrow = mysql_fetch_array($result));
echo "</TABLE>\n";
}
} while ($myrow2 = mysql_fetch_array($result2));
}
.....
Of course this didn't work
.
First of all I can't create variables for the SELECT statement. I constantly get errors.
Secondly, this just ain't the way, but I'm trying to figure that out!
Can someone help me with this please, or are there some examples on the net where I didnt ran into.
Tnx all!
Please all consider that I'm new with PHP and MYSQL (and that I'm Dutch).
I'm working on a site where I want to embed information from two db-tables into one web-table.
I'm using three tables from my db: Users (UserID, Name, etc), Rubrics(RubricID,UserID,Rubricname) and Links(URLID,RubricID,URLname,URLadress).
When I'm logging in I want to see all my favorit links categorized in rubrics. So therefore I want to create a table for each rubric and that specific table must contain the links with the same RubricID.
I tried something like this:
......
result2 = mysql_query("SELECT * FROM Rubrics WHERE userID=1");
$result = mysql_query("SELECT * FROM links WHERE RubricID=1");
if ($myrow2 = mysql_fetch_array($result2)) {
do {
echo "<TABLE border=1>\n";
printf("<TR><TD>%s </TD></TR>\n", $myrow2["Rubricname"]);
if ($myrow = mysql_fetch_array($result)) {
do {
printf("<TR><TD>%s </TD></TR>\n", $myrow["URLname"]);
} while ($myrow = mysql_fetch_array($result));
echo "</TABLE>\n";
}
} while ($myrow2 = mysql_fetch_array($result2));
}
.....
Of course this didn't work

First of all I can't create variables for the SELECT statement. I constantly get errors.
Secondly, this just ain't the way, but I'm trying to figure that out!
Can someone help me with this please, or are there some examples on the net where I didnt ran into.
Tnx all!