I've started writting the database and PHP to go with it. So far everything is great but I've got a delima.
I have a table called spidernet_application. The way we want the site to work is that there is a Division (6) and Departments under them. I've written it so that blog_id = Division and category_id = Department. That works perfectly. You select say Division 2 and you get a dropdown list of all of Division 2 category's perfectly.
Where my delima comes from though is our applications part. Each Division has its own "global" application set and each Department has their own as well. I've got one table for it called spidernet_application that does them both. But when I say "show me all of the ones with a 2 on them" all of them show up. It's like I need to be able to say something like "If blog=id = 1 and category_id = 901 then display here and if category_id = $category_id (where they are currently like say 37 and there is something there in 37 display it in this table). How do you write that? Here's my code:
<?php
echo $blockopen;
echo $siteID." Apps.";
echo $blockbody;
while ($a_row = mysql_fetch_array( $divapp ) ) {
$app_url=$a_row['url'];
$app_image=$a_row['image_location'];
$app_alt=$a_row['description'];
print "<a href=\"$app_url\"><img src=\"$app_image\" alt=\"$app_alt\" border=\"0\"></a><br> ";
}
echo $blockend;
?>
My SQL statement looks like this:
$divapp = mysql_query( "SELECT `blog_id`, `url`, `image_location`, `description` FROM spidernet_applications WHERE `blog_id`=".$dept." ;" );
This is probably a simple thing I'm just no well versed in Databases. You'd be surprised all I've learned since posting here. You guys are amazing.
Digatle
I have a table called spidernet_application. The way we want the site to work is that there is a Division (6) and Departments under them. I've written it so that blog_id = Division and category_id = Department. That works perfectly. You select say Division 2 and you get a dropdown list of all of Division 2 category's perfectly.
Where my delima comes from though is our applications part. Each Division has its own "global" application set and each Department has their own as well. I've got one table for it called spidernet_application that does them both. But when I say "show me all of the ones with a 2 on them" all of them show up. It's like I need to be able to say something like "If blog=id = 1 and category_id = 901 then display here and if category_id = $category_id (where they are currently like say 37 and there is something there in 37 display it in this table). How do you write that? Here's my code:
<?php
echo $blockopen;
echo $siteID." Apps.";
echo $blockbody;
while ($a_row = mysql_fetch_array( $divapp ) ) {
$app_url=$a_row['url'];
$app_image=$a_row['image_location'];
$app_alt=$a_row['description'];
print "<a href=\"$app_url\"><img src=\"$app_image\" alt=\"$app_alt\" border=\"0\"></a><br> ";
}
echo $blockend;
?>
My SQL statement looks like this:
$divapp = mysql_query( "SELECT `blog_id`, `url`, `image_location`, `description` FROM spidernet_applications WHERE `blog_id`=".$dept." ;" );
This is probably a simple thing I'm just no well versed in Databases. You'd be surprised all I've learned since posting here. You guys are amazing.
Digatle