Hejsa folkens, mit navn er Kristian Andersen og jeg er rimelig inde for faget Webprogrammering, og håber i kan hjælpe mig
Jeg står med et system hvor jeg har denne MYSQL tabel:
`id` int(8) NOT NULL auto_increment,
`writer` varchar(100) NOT NULL default '',
`name` varchar(100) NOT NULL default '',
`joke` longtext NOT NULL,
`cat` varchar(100) NOT NULL default '',
`date` varchar(100) NOT NULL default '',
`time` varchar(100) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
jeg fandt en artikel på rowl.dk men jeg kan ikke få det til at virke, så jeg håber nogle kan hjælpe mig med det, så jeg kan få sider på mit billedesystem, så der er 10 pr side
Nogle som kan hjælpe mig? Og hvad jeg evt. skal tilføje til min mysql tabel (hvis jeg skal det), osv
?
Koden til mit system:
<?php include("../header.php");?>
<?php include ("../topmenu.php");?>
<?php include("../venstre.php");?>
</div>
<div id="right-col1">
<!-- Services Block Starts Here -->
<div class="content-block1">
<div class="content-block1-top"></div>
<div class="content-block1-bottom">
<h4>Billedesektion</h4>
<p>
<?php include('config.php');?>
<style>
body, table, input, textarea, select
{
color: #000000;
font-size: 11px;
font-family: Verdana;
}
a:link, a:visited, a:active
{
font-family: Verdana;
font-size: 11px;
text-decoration: none;
color: #000000;
}
a:hover
{
font-family: Verdana;
font-size: 11px;
text-decoration: none;
color: #49730b;
}
</style>
<table width="80%" cellpadding="0" cellspacing="0" align="center">
<tr bgcolor="<?php print $tables_row1; ?>">
<td width="40%"><b>Billeder</b></td><td width="40%"><b>Kategori</b></td>
</tr>
<?php
$cat = $_GET['cat'];
if (empty($cat)) {
$db_hent = mysql_query("SELECT * FROM `sb_billedesystem` ORDER BY `name` ASC");
} else {
$db_hent = mysql_query("SELECT * FROM `sb_billedesystem_cat` WHERE cat = '".$cat."' ORDER BY `name` ASC");
}
$jokes = mysql_num_rows($db_hent);
while ($hent = mysql_fetch_array($db_hent)) {
if ($color == $tables_row1||empty($color)) {
$color = $tables_row2;
} else {
$color = $tables_row1;
}
$id = $hent['id'];
$jokename = $hent['name'];
$categori = $hent['cat'];
$categori_F = getCat($categori, "");
echo " <tr bgcolor=\"".$color."\">\n";
echo " <td><a href=\"billede.php?id=".$id."\">".$jokename."</a></td><td>".$categori_F."</td><td>".$bite."</td>\n";
echo " </tr>\n";
}
if ($jokes == 0||empty($jokes)) {
if ($color == $tables_row1||$color == "") {
$color = $tables_row2;
} else {
$color = $tables_row1;
}
echo " <tr bgcolor=\"".$color."\">\n";
echo " <td> </td><td><font color='red'><b>FEJL:</b> Ingen billeder blev fundet!</font></td><td> </td>\n";
echo " </tr>\n";
}
if ($color == $tables_row1||$color == "") {
$color = $tables_row2;
} else {
$color = $tables_row1;
}
echo " <tr bgcolor=\"".$color."\">\n";
echo " <td> </td>\n";
echo " <td> </td>\n";
echo " <td>\n";
echo " <select onchange=\"window.location.href = this.options[this.selectedIndex].value;\">\n";
$count_numb = mysql_query("SELECT * FROM `sb_billedesystem`") or die (mysql_error());
$final_number = mysql_num_rows($count_numb);
echo " <option value=\"".$_SERVER['PHP_SELF']."\">Alle kategorier(".$final_number.")</option>\n";
$db_hent = mysql_query("SELECT * FROM `sb_billedesystem` ORDER BY `cat` ASC");
while ($hent = mysql_fetch_array($db_hent)) {
$catname = $hent['cat'];
$number = $hent['id'];
$count_numb = mysql_query("SELECT * FROM `sb_billedesystem` WHERE `cat` = '".$number."'") or die (mysql_error());
$final_number = mysql_num_rows($count_numb);
if ($cat == $number) {
echo " <option value=\"".$_SERVER['PHP_SELF']."?cat=".$number."\" selected=\"selected\">".$catname."(".$final_number.")</option>\n";
} else {
echo " <option value=\"".$_SERVER['PHP_SELF']."?cat=".$number."\">".$catname."(".$final_number.")</option>\n";
}
}
echo " </select>\n";
echo " </td>\n";
echo " </tr>\n";
?>
</table>
</p>
</div>
</div>
</div>
</div>
<?php include("../footer.php");?>
</div>
</body>
</html>
Mvh. Kristian, husk at nyde det gode vejr