Jump to content

Having Problems with MySQL


blufish

Recommended Posts

Here is the code, I does not return anything...

<?php
if (isset($_POST['where'])) {
$_POST['p'] = $_POST['where'];
}
if (!isset($_POST['p'])) {
$_POST['p'] = "home";
}
$current_page = $_POST['p'];

if ($current_page=="home") {
if (!isset($_POST['sort_by')) {
$_POST['sort_by'] = "pagetitle";
}
if ($_POST['sort_by']=="pagetitle") {
$sort_pages_by = "page_title";
}
if ($_POST['sort_by']=="pagehits") {
$sort_pages_by = "page_hits";
}
if ($_POST['sort_by']=="pagevotes") {
$sort_pages_by = "vote_good";
}

if (!isset($_POST['only_show'])) {
$_POST['only_show'] = "all";
}
if ($_POST['only_show']=="all") {
$page_type = "*";
}
if ($_POST['only_show']=="images") {
$page_type = "images";
}
if ($_POST['only_show']=="text") {
$page_type = "text";
}

$page_title = "Welcome to Frozenoven!";
$page_contents = "<p>Welcome to Frozenoven, here you can search our content with our database, </p>";
$database_connect = mysql_connect("sql204.byethost7.com","b7_2627673","turds12");
if (!$database_connect) {
die('Error Connecting to Database: ' . mysql_error());
}

$select_database = mysql_select_db("b7_2627673_pages", $database_connect);
if (!select_database)
{
die ("Error Selecting Database: " . mysql_error());
}

$page_contents = $page_contents."<table><tr><th>Page Title</th><th>Thumb Ups!</th><th>Page Hits</th></tr>";
$page_query = mysql_query("SELECT * FROM page_info WHERE page_type=".$page_type." ORDER BY ".$sort_pages_by) or die(mysql_error());
while($page_values = mysql_fetch_array($page_query))
{
$page_contents =  $page_contents."<tr><td><a href='".$page_values['page_name']."'>".$page_values['page_title'] ."</a></td><td>".$page_values

['vote_good']."</td><td>".$page_values['page_hits']."</td></tr>";
}
$page_contents = $page_contents."</table>";
mysql_close($database_connect);
}
echo page_contents;
?>

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.