Ow damn. it should be:
switch ($type) {
case 'general': {
}
case 'quests': {
}
Sorry about that.
pritaeas
Posting Expert
5,446 posts since Jul 2006
Reputation Points: 653
Solved Threads: 873
Can you give me a specific example ?
pritaeas
Posting Expert
5,446 posts since Jul 2006
Reputation Points: 653
Solved Threads: 873
If you output your name and description like this:
<table>
<tr>
<th class="title">name</th>
</tr>
<tr>
<td class="description">description</td>
</tr>
</table>
you could use a css file to change the layout, e.g. like this:
th.title {
font-weight: bold;
color: #000080;
}
td.description {
color: #800000;
font-style: italic;
}
pritaeas
Posting Expert
5,446 posts since Jul 2006
Reputation Points: 653
Solved Threads: 873
Something like this:
<table>
<?php
$db_link = @mysql_connect('localhost', 'username', 'pass') or die(mysql_error());
@mysql_select_db('wowtahc1_achievements') or die(mysql_error());
$type = $_GET['type'];
switch ($type) {
case 'general': {
$query = 'SELECT * FROM general';
$result = @mysql_query($query) or die(mysql_error());
if ($result)
{
while ($row = mysql_fetch_assoc($result))
{
echo '<tr>';
echo '<th class="title">' . $row['Name'] . '</th>';
echo '<td class="description">' . $row['Description'] . '</td>';
echo '</tr>';
}
mysql_free_result($result);
}
break;
}
case 'quests': {
$query = 'SELECT * FROM quests';
$result = @mysql_query($query) or die(mysql_error());
if ($result)
{
while ($row = mysql_fetch_assoc($result))
{
echo '<tr>';
echo '<th class="title">' . $row['Name'] . '</th>';
echo '<td class="description">' . $row['Description'] . '</td>';
echo '</tr>';
}
mysql_free_result($result);
}
break;
}
}
mysql_close($db_link)
?>
</table>
pritaeas
Posting Expert
5,446 posts since Jul 2006
Reputation Points: 653
Solved Threads: 873
It would be something like this. I assume you have a column 'id' in your tables that identifies each separate record.
<table>
<?php
$db_link = @mysql_connect('localhost', 'username', 'pass') or die(mysql_error());
@mysql_select_db('wowtahc1_achievements') or die(mysql_error());
$id = isset($_GET['id']) ? $_GET['id'] : 0;
$type = $_GET['type'];
switch ($type)
{
case 'general': {
if ($id < 1)
{
$query = 'SELECT * FROM general';
$result = @mysql_query($query) or die(mysql_error());
if ($result)
{
while ($row = mysql_fetch_assoc($result))
{
echo '<tr>';
echo '<th class="title"><a href="achievements.php?type=general&id=' . $row['Id'] . '">' . $row['Name'] . '</a></th>';
echo '<td class="description">' . $row['Description'] . '</td>';
echo '</tr>';
}
mysql_free_result($result);
}
}
else
{
$query = "SELECT * FROM general WHERE id=$id";
$result = @mysql_query($query) or die(mysql_error());
if ($result)
{
if ($row = mysql_fetch_assoc($result))
{
echo '<tr>';
echo '<th class="title">' . $row['Name'] . '</th>';
echo '<td class="description">' . $row['Description'] . '</td>';
echo '</tr>';
}
mysql_free_result($result);
}
}
break;
}
case 'quests':
{
if ($id < 1)
{
$query = 'SELECT * FROM quests';
$result = @mysql_query($query) or die(mysql_error());
if ($result)
{
while ($row = mysql_fetch_assoc($result))
{
echo '<tr>';
echo '<th class="title"><a href="achievements.php?type=quests&id=' . $row['Id'] . '">' . $row['Name'] . '</a></th>';
echo '<td class="description">' . $row['Description'] . '</td>';
echo '</tr>';
}
mysql_free_result($result);
}
}
else
{
$query = "SELECT * FROM quests WHERE id=$id";
$result = @mysql_query($query) or die(mysql_error());
if ($result)
{
if ($row = mysql_fetch_assoc($result))
{
echo '<tr>';
echo '<th class="title">' . $row['Name'] . '</th>';
echo '<td class="description">' . $row['Description'] . '</td>';
echo '</tr>';
}
mysql_free_result($result);
}
}
break;
}
}
mysql_close($db_link)
?>
</table>
pritaeas
Posting Expert
5,446 posts since Jul 2006
Reputation Points: 653
Solved Threads: 873
A blob field is just binary data, which in your code gets displayed as text. The most easy way would be to create a separate php page that retrieves your image and displays it. I have an example of this in my original admin panel. I'll need some time to make an example for you.
This thread has a working example, so hopefully you won't need a demo from me: http://www.phpbuilder.com/board/showthread.php?t=10252369
pritaeas
Posting Expert
5,446 posts since Jul 2006
Reputation Points: 653
Solved Threads: 873
You can remove the require(tools), it's something from the other guys code.
You shouldn't have changed "image" into "Picture".
I have a very busy week this week, so I haven't got around to making you a demo.
pritaeas
Posting Expert
5,446 posts since Jul 2006
Reputation Points: 653
Solved Threads: 873
pritaeas
Posting Expert
5,446 posts since Jul 2006
Reputation Points: 653
Solved Threads: 873