[PHP/MYSQL]Not Working ~ News System[PHP/MYSQL]

Status
Not open for further replies.

Li1M0ST3Rz

I <3 Bianca
Sep 13, 2010
269
166
Okay i coded a news system:
PHP:
        <?php
        include './lib/config.php';
        $_result = mysql_query("SELECT * FROM news");
        while($news = mysql_fetch_array($_result))
        $id = $news['id'];
        {
            if(isset($_GET['id='.$id.'']))
                {
                    $_resulted = mysql_query("SELECT * FROM news WHERE id=".$id."");
                    while($n_news = mysql_fetch_array($_resulted))
                        {
                            echo 'Topic: '. $n_news['topic'] .' <p>'.$n_news['body'].'</p> <p>Author: '.$n_news['author'].'</p>';
                        }
                }
        }
        ?>
and it given me this and the news database filled with an table:
o5yEZeekoge0.png
 

Ept

Many men wish death upon me.
Jun 16, 2011
591
276
PHP:
<?php
        include './lib/config.php';
        $_result = mysql_query("SELECT * FROM news");
        while($news = mysql_fetch_array($_result))
        {
          $id = $news['id'];
            if(isset($_GET['.$id.']))
                {
                    $_resulted = mysql_query("SELECT * FROM news WHERE id=".$id."");
                    while($n_news = mysql_fetch_array($_resulted))
                        {
                            echo 'Topic: '. $n_news['topic'] .' <p>'.$n_news['body'].'</p> <p>Author: '.$n_news['author'].'</p>';
                        }
                }
        }
        ?>
Try that, it should work.
 

Li1M0ST3Rz

I <3 Bianca
Sep 13, 2010
269
166
PHP:
<?php
        include './lib/config.php';
        $_result = mysql_query("SELECT * FROM news");
        while($news = mysql_fetch_array($_result))
        {
          $id = $news['id'];
            if(isset($_GET['.$id.']))
                {
                    $_resulted = mysql_query("SELECT * FROM news WHERE id=".$id."");
                    while($n_news = mysql_fetch_array($_resulted))
                        {
                            echo 'Topic: '. $n_news['topic'] .' <p>'.$n_news['body'].'</p> <p>Author: '.$n_news['author'].'</p>';
                        }
                }
        }
        ?>
Try that, it should work.
Still dont work..
 

Sean

‫‫‫‫‫‫  ‫  Don't Worry, Be Happy
Dec 12, 2011
1,121
405
PHP:
<?php
      include "../lib/config.php";
      $result = mysql_query("SELECT * FROM news");
      while($news = mysql_fetch_array($result)) {
          $id = $news['id'];
          if(isset($_GET[' " .  $id . "'])) {
              $resulted = mysql_query("SELECT * FROM news WHERE id='" . $id . "'");
              while($news = mysql_fetch_array($resulted)) {
                  echo 'Topic: '. $news['topic'] .' <p>'.$news['body'].'</p> <p>Author: '.$news['author'].'</p>';
              }
          }
      }
?>
 

Li1M0ST3Rz

I <3 Bianca
Sep 13, 2010
269
166
PHP:
<?php
      include "../lib/config.php";
      $result = mysql_query("SELECT * FROM news");
      while($news = mysql_fetch_array($result)) {
          $id = $news['id'];
          if(isset($_GET[' " .  $id . "'])) {
              $resulted = mysql_query("SELECT * FROM news WHERE id='" . $id . "'");
              while($news = mysql_fetch_array($resulted)) {
                  echo 'Topic: '. $news['topic'] .' <p>'.$news['body'].'</p> <p>Author: '.$news['author'].'</p>';
              }
          }
      }
?>
not working to thanks for helping.
 

Li1M0ST3Rz

I <3 Bianca
Sep 13, 2010
269
166
PHP:
<?php
#################################
# ==    Mysql connection  ==  #
#################################
 
mysql_connect("localhost", "root", "Lol123") or die(mysql_error());
mysql_select_db("supreme") or  die('<div class="msgError">Connection couldnt connect wow fix it!.</div>');
//////////////////////////////////
//    ==        Site Config        == //
////////////////////////////////
$_site['lname'] = 'SupremeCMS';
$_site['sname'] = 'Supreme';
$_site['copyright'] = 'Copyright &copy; 2012';
$_site['version'] = '1.0';
 
?>
 

Ryabs

Christmas Donator
Dec 30, 2011
343
39
Okay i coded a news system:
PHP:
        <?php
        include './lib/config.php';
        $_result = mysql_query("SELECT * FROM news");
        while($news = mysql_fetch_array($_result))
        $id = $news['id'];
        {
            if(isset($_GET['id='.$id.'']))
                {
                    $_resulted = mysql_query("SELECT * FROM news WHERE id=".$id."");
                    while($n_news = mysql_fetch_array($_resulted))
                        {
                            echo 'Topic: '. $n_news['topic'] .' <p>'.$n_news['body'].'</p> <p>Author: '.$n_news['author'].'</p>';
                        }
                }
        }
        ?>
and it given me this and the news database filled with an table:
o5yEZeekoge0.png
Thought you were great at coding?
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,132
2,456
PHP:
        <?php
        include ('./lib/config.php');
        $result = mysql_query("SELECT * FROM news");
        $id = $_GET['id'];
        while($news = mysql_fetch_array($_result))
        {
            if(isset($id))
                {
                    $_resulted = mysql_query("SELECT * FROM news WHERE id='.$id.'");
                    while($n_news = mysql_fetch_array($_resulted))
                        {
                            echo 'Topic: ". $n_news['topic'] ." <p>".$n_news['body']."</p> <p>Author: ".$n_news['author']."</p>';
                        }
                }
        }
        ?>
 

Sean

‫‫‫‫‫‫  ‫  Don't Worry, Be Happy
Dec 12, 2011
1,121
405
PHP:
<?php
    require_once('../lib/config.php');
    if (isset($_GET["id"])) { $article  = $_GET["id"]; } else { $article=1; };
    $start = ($article-1) * 1;
    $sql = "SELECT * FROM news ORDER BY id ASC LIMIT $start, 1";
    $result = mysql_query($sql);
    while ($row = mysql_fetch_assoc($result)) {
        echo 'Topic: '. $row['topic'] .' <p>'.$row['body'].'</p> <p>Author: '.$row['author'].'</p>';
    }
?>
 

Li1M0ST3Rz

I <3 Bianca
Sep 13, 2010
269
166
PHP:
<?php
    require_once('../lib/config.php');
    if (isset($_GET["id"])) { $article  = $_GET["id"]; } else { $article=1; };
    $start = ($article-1) * 1;
    $sql = "SELECT * FROM news ORDER BY id ASC LIMIT $start, 1";
    $result = mysql_query($sql);
    while ($row = mysql_fetch_assoc($result)) {
        echo 'Topic: '. $row['topic'] .' <p>'.$row['body'].'</p> <p>Author: '.$row['author'].'</p>';
    }
?>
it worked thanks
 
Status
Not open for further replies.

Users who are viewing this thread

Top