edawg
01-29-2007, 09:10 PM
Hi, I'm trying to update a current pictures site from html into php with a mysql backend, im pretty new to php and mysql and have run into a problem I cant seem to remedy??, any help would be great!.
I have set up the database, and in the database I have 2 tables so far, one is for the pictures categories which has the names of the categories, and the urls, and the other is for the pictures which has the title of the pictures, and filenames and description, so I linked them both with a associated primary/foreign key relationship.
Now my problem is with a section on my site I would like the latest pictures posted to be shown, so I used a href so you can click on anyone and it will take you to that pictures category, the only problem is I get the latest pictures showing up fine, but when I put the mouse on them the url is the same all the way down, rather than change for each individual picture category, it stays the same link?, ive tried as much as I know so far, but still the same problems?, what can I do?.
mysql_select_db($database, $connDB) OR DIE ('Unable To Select That Database' . mysql_error() );
$query_sPictures = "SELECT site_pictures.sp_filename_TN, site_pictures.sp_ALT FROM site_pictures ORDER BY site_pictures.sp_timestamp ASC";
$sPictures = @mysql_query($query_sPictures, $connDB) or die(mysql_error());
$row_sPictures = mysql_fetch_assoc($sPictures);
$totalRows_sPictures = mysql_num_rows($sPictures); <-- This part works fine
?>
<?php
$query_sCategories = "SELECT site_categories.sc_url FROM site_categories, site_pictures WHERE site_pictures.sc_id = site_categories.sc_id";
$sCategories = @mysql_query($query_sCategories, $connDB) or die(mysql_error());
$row_sCategories = mysql_fetch_assoc($sCategories);
$totalRows_sCategories = mysql_num_rows($sCategories);
?>
<?php do { ?><a href="<?php echo $row_sCategories['sc_url'];?>"> <-- This is where the problem is??.
<img src="pictures/<?php echo $row_sPictures['sp_filename_TN']; ?>" alt="<?php echo $row_sPictures['sp_ALT'];?>"></img>[/url]
<?php } while ($row_sPictures = mysql_fetch_assoc($sPictures));
mysql_close();?>
Any help would be great, im pulling my hair out with this!!!!!!.
Other forums have not been too helpfull!!.
I have set up the database, and in the database I have 2 tables so far, one is for the pictures categories which has the names of the categories, and the urls, and the other is for the pictures which has the title of the pictures, and filenames and description, so I linked them both with a associated primary/foreign key relationship.
Now my problem is with a section on my site I would like the latest pictures posted to be shown, so I used a href so you can click on anyone and it will take you to that pictures category, the only problem is I get the latest pictures showing up fine, but when I put the mouse on them the url is the same all the way down, rather than change for each individual picture category, it stays the same link?, ive tried as much as I know so far, but still the same problems?, what can I do?.
mysql_select_db($database, $connDB) OR DIE ('Unable To Select That Database' . mysql_error() );
$query_sPictures = "SELECT site_pictures.sp_filename_TN, site_pictures.sp_ALT FROM site_pictures ORDER BY site_pictures.sp_timestamp ASC";
$sPictures = @mysql_query($query_sPictures, $connDB) or die(mysql_error());
$row_sPictures = mysql_fetch_assoc($sPictures);
$totalRows_sPictures = mysql_num_rows($sPictures); <-- This part works fine
?>
<?php
$query_sCategories = "SELECT site_categories.sc_url FROM site_categories, site_pictures WHERE site_pictures.sc_id = site_categories.sc_id";
$sCategories = @mysql_query($query_sCategories, $connDB) or die(mysql_error());
$row_sCategories = mysql_fetch_assoc($sCategories);
$totalRows_sCategories = mysql_num_rows($sCategories);
?>
<?php do { ?><a href="<?php echo $row_sCategories['sc_url'];?>"> <-- This is where the problem is??.
<img src="pictures/<?php echo $row_sPictures['sp_filename_TN']; ?>" alt="<?php echo $row_sPictures['sp_ALT'];?>"></img>[/url]
<?php } while ($row_sPictures = mysql_fetch_assoc($sPictures));
mysql_close();?>
Any help would be great, im pulling my hair out with this!!!!!!.
Other forums have not been too helpfull!!.