#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    1
    Rep Power
    0

    Display Data into website using pid


    I want to display data into web page when user clicks on Menu Navigation into same web page.

    I have done the following code:

    Header.php where Menu Navigation bar is:
    [code]
    <ul id="menu">
    <?php
    include 'ClsDatabase.php';
    include 'config.php';
    $query="select * from tbl_pageinfo";
    $user= new ClsDatabase();
    $a=$user->selectRecord($query);
    while($record=mysql_fetch_array($a))
    {
    ?>
    <li><a href="welcomepage.php?pid=<?php echo $record["page_name"];?>" ><?php echo $record["page_name"];?></a></li>
    <?php } ?>
    </ul>

    Welcomepage.php where I want to show data when user clicks on any item on Menu.

    welcomepage.php
    [code]
    <?php
    $a=$_GET["pid"];
    $link_id=mysql_connect("localhost","root","sqldb");
    mysql_select_db("CMS",$link_id);
    $query1="SELECT * FROM tbl_pageinfo where page_name=$a";
    $res=mysql_query($query1);

    ?>
    <!-- START .grid_9 - LEFT CONTENT -->
    <div class="grid_9 cnt" id="left">
    <h1>Dashboard</h1>
    <div id="lipsum">

    <?php
    while($record=mysql_fetch_array($res))
    { ?>
    <p><?php echo $record["page_desc"];?></p>
    <?php } ?>

    Please help!
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,957
    Rep Power
    1045
    Hi,

    so what's your question? What's wrong with the current code?

    By the way, you should be careful with those echos and that "... where page_name=$a":

    Donít insert raw values into query strings.
    Donít output raw values or insert them into the HTML page.

IMN logo majestic logo threadwatch logo seochat tools logo