Jump to content

php coding


bonito1

Recommended Posts

<?php require_once('Connections/check_mag.php'); ?>

what goes wrong with that code and when i push a link for another post in my page nothing changes? where is the wrong plzzzzz help i cant understand im looking for this for 5 days and i cant find the mistake pllzzzzzzzz heellp . if you write your cooment plz give me details because i cant understand very well everything thanx for everythin:)

 

 

 

 

 

 

<?php

if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

  if (PHP_VERSION < 6) {

    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  }

 

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

 

  switch ($theType) {

    case "text":

      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

      break;   

    case "long":

    case "int":

      $theValue = ($theValue != "") ? intval($theValue) : "NULL";

      break;

    case "double":

      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";

      break;

    case "date":

      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

      break;

    case "defined":

      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

      break;

  }

  return $theValue;

}

}

 

mysql_select_db($database_check_mag, $check_mag);

$query_getArchives = "SELECT DISTINCT DATE_FORMAT(news.updated, '%M %Y') AS archive,  DATE_FORMAT(news.updated, '%Y-%m') AS link FROM news ORDER BY news.updated DESC ";

$getArchives = mysql_query($query_getArchives, $check_mag) or die(mysql_error());

$row_getArchives = mysql_fetch_assoc($getArchives);

$totalRows_getArchives = mysql_num_rows($getArchives);

 

mysql_select_db($database_check_mag, $check_mag);

$query_getRecent = "SELECT news.post_id, news.title FROM news ORDER BY news.updated DESC LIMIT 10 ";

$getRecent = mysql_query($query_getRecent, $check_mag) or die(mysql_error());

$row_getRecent = mysql_fetch_assoc($getRecent);

$totalRows_getRecent = mysql_num_rows($getRecent);

 

mysql_select_db($database_check_mag, $check_mag);

$query_getDisplay = "SELECT news.title, news.blog_entry,  DATE_FORMAT(news.updated, '%M %e, %Y') AS formatted FROM news ORDER BY news.updated DESC LIMIT 2 ";

$getDisplay = mysql_query($query_getDisplay, $check_mag) or die(mysql_error());

$row_getDisplay = mysql_fetch_assoc($getDisplay);

$totalRows_getDisplay = mysql_num_rows($getDisplay);

 

$var1_getdisplay2 = "-1";

if (isset($_GET['archive'])) {

  $var1_getdisplay2 = $_GET['archive'];

 

$query_getdisplay = sprintf("SELECT news.title, news.blog_entry, DATE_FORMAT(news.updated, '%%M %%e, %%Y') AS formatted FROM news WHERE DATE_FORMAT(news.updated, '%%Y-%%m') = %s ORDER BY news.updated DESC ", GetSQLValueString($var1_getdisplay2, "text"));

 

}elseif (isset($_GET['post_id'])) {

  $var2_getdisplay3 = $_GET['post_id'];

 

$query_getdisplay= sprintf("SELECT news.title, news.blog_entry, DATE_FORMAT(news.updated, '%%M %%e, %%Y') AS formatted FROM news WHERE news.post_id = %s ", GetSQLValueString($var2_getdisplay3, "int"));

}else{

$query_getDisplay = "SELECT news.title, news.blog_entry,  DATE_FORMAT(news.updated, '%M %e, %Y') AS formatted FROM news ORDER BY news.updated DESC LIMIT 2 ";}

$getDisplay = mysql_query($query_getDisplay, $check_mag) or die(mysql_error());

$row_getDisplay = mysql_fetch_assoc($getDisplay);

$totalRows_getDisplay = mysql_num_rows($getDisplay);

 

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/totemp.dwt.php" codeOutsideHTMLIsLocked="false" -->

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<meta name="robots" content="index, follow" />

  <meta name="keywords" content="Σύλλογος Ηπειρωτών Πιερίας,Χορευτικός Σύλλογος,Χορός,Χορευτής,Ήπειρος,SYLLOGOS HPIROTON PIERIAS,pieria,ΠΙΕΡΙΑ" />

  <meta name="description" content="Σύλλογος Ηπειρωτών Πιερίας,Χορευτικός Σύλλογος,Χορός,Χορευτής,Ήπειρος,SYLLOGOS HPIROTON PIERIAS,pieria,ΠΙΕΡΙΑ" />

<!-- InstanceBeginEditable name="doctitle" -->

<title>Check Magazine</title>

<!-- InstanceEndEditable -->

<link href="styles/check_cs5.css" rel="stylesheet" type="text/css" />

<link href="styles/check_menu.css" rel="stylesheet" type="text/css" />

<!-- InstanceBeginEditable name="head" -->

<!-- InstanceEndEditable -->

</head>

 

<body>

<!-- DO NOT MOVE! The following AllWebMenus linking code section must always be placed right AFTER the BODY tag-->

<!-- ******** BEGIN ALLWEBMENUS CODE FOR menu ******** -->

<script type="text/javascript">var MenuLinkedBy="AllWebMenus [4]",awmMenuName="menu",awmBN="798";awmAltUrl="";</script><script charset="UTF-8" src="menu.js" type="text/javascript"></script><script type="text/javascript">awmBuildMenu();</script>

<!-- ******** END ALLWEBMENUS CODE FOR menu ******** -->

 

<div id="container">

  <h1>Check Magazine: Fashion and Lifestyle</h1>

  <div id="eikona"><img src="images/silogos.jpg" width="1211" height="134" alt="silogos" /></div>

  <div id="bara">

    <p> </p>

  </div>

  <!-- InstanceBeginEditable name="EditRegion3" -->

  <div id="blog">

    <p> </p>

    <div id="archive">

      <h3>Archives</h3>

      <ul><?php do{?>

        <li><a href="news1.php">

          <a href="news1.php"><?php echo $row_getArchives['archive'];?></a><a></li>

        <?php } while ($row_getArchives=mysql_fetch_assoc($getArchives));?>

      </ul>

    </div>

    <div id="recent">

      <h3>RECENT</h3>

      <ul>

      <?php do { ?>

        <li><a href="news1.php?post_id=<?php echo $row_getRecent['post_id']; ?>"><?php echo $row_getRecent['title']; ?></a></li>

        <?php } while ($row_getRecent = mysql_fetch_assoc($getRecent)); ?>

      </ul>

    </div>

    <div id="blog_posts">

      <?php do { ?>

        <h2><?php echo $row_getDisplay['title']; ?></h2>

        <p>Uploaded on <?php echo $row_getDisplay['formatted']; ?></p>

        <p><?php echo nl2br($row_getDisplay['blog_entry']); ?></p>

        <?php } while ($row_getDisplay = mysql_fetch_assoc($getDisplay)); ?>

    </div>

    <p> </p>

    <p> </p>

    <p> </p>

    <p> </p>

    <p> </p>

    <p> </p>

  </div>

  <!-- InstanceEndEditable -->

  <p> </p>

</div>

</body>

<!-- InstanceEnd --></html>

<?php

mysql_free_result($getArchives);

 

mysql_free_result($getRecent);

 

mysql_free_result($getDisplay);

 

 

?>

Link to comment
https://forums.phpfreaks.com/topic/232162-php-coding/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.