Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Nov 2008
    Posts
    27
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Character Bios Page

    I didn't know if this belonged with MySQL or PHP but... here's the deal, I have had a website for some time now and it has been through many changes. For example, I formatted my entire site to fit the same template. While working on converting old pages to the new template I noticed some errors that weren't there originally there.

    The biggest one and the only one I have been unable to fix is the Character Bios Page for my animation series.

    The Bios Index is completely functional, here is the code:

    charbios.php
    PHP Code:
     <div id='biostable'>
          <ul class='style'>
          <?php 
            $user
    ="root";
            
    $password="k66t6M9";
            
    $database="bios";
            
    mysql_connect("127.0.0.1",$user,$password);
            @
    mysql_select_db($database) or die( "Unable to select database");
            
    $query="SELECT * FROM biospg";
            
    $result=mysql_query($query);
            while (
    $row=mysql_fetch_array($result)) {
                echo 
    sprintf ("<li class='style2'><a href='char2.php?id={$row["ID"]}'>{$row["name"]}</a></li>");
            }
          
    ?>
          </ul>
          </div>
    This page is completely functional.

    However, the actual character bios does not work as you see when you click any of the links in the character index. Here is the code for that page:

    char.php
    PHP Code:
    <?php 
            $user
    ="root";
            
    $password="k66t6M9";
            
    $database="bios";
            
    mysql_connect("127.0.0.1",$user,$password);
            @
    mysql_select_db($database) or die( "Unable to select database");
            
    $query="SELECT * FROM biospg WHERE name='$name'";
            
    $result mysql_query($query); 
            while (
    $row mysql_fetch_array($result))  {
                echo 
    sprintf ("<table cellspacing='0' cellpadding='3px' id='chartable' border='2'>\n");
                echo 
    sprintf ("<tr> \n");
                echo 
    sprintf ("<td class='name'>\n"); 
                echo 
    sprintf ("{$row["name"]}");
                echo 
    sprintf ("</td>\n");
                echo 
    sprintf ("</tr>\n");
                echo 
    sprintf ("<tr>\n");
                echo 
    sprintf ("<td class='desc'>\n");
                echo 
    sprintf ("{$row["description"]}\n");
                echo 
    sprintf ("</td>\n");
                echo 
    sprintf ("</tr>\n");
                echo 
    sprintf ("<tr>\n");
                echo 
    sprintf ("<td class='pict'>\n");
                echo 
    sprintf ("<center>\n");
                echo 
    sprintf ("<img src='{$row["image"]}' align='center' />\n");
                echo 
    sprintf ("</center>\n");
                echo 
    sprintf ("</td>\n");
                echo 
    sprintf ("</tr>\n");
                echo 
    sprintf ("</table>\n");
            }
    ?>
    As you can see if you follow the links the page appears empty. Does anyone know why the content is not showing up? Any help would be great. Thanks in advance.

  • #2
    met
    met is offline
    Regular Coder
    Join Date
    Oct 2009
    Location
    United Kingdom
    Posts
    728
    Thanks
    4
    Thanked 119 Times in 119 Posts
    add

    PHP Code:
    <?php 
            $user
    ="root";
            
    $password="k66t6M9"/* lol */
            
    $database="bios";
            
    mysql_connect("127.0.0.1",$user,$password);
            @
    mysql_select_db($database) or die( "Unable to select database");
    /* --------------- */    
            
    $name=$_GET['id'];
            
    $query="SELECT * FROM biospg WHERE name=".$name." LIMIT 1";
    // snip
    but you should validate $name first to prevent any kind of attempted hack. check its an integer etc.

  • Users who have thanked met for this post:

    ParadoxKing (11-03-2009)

  • #3
    Senior Coder
    Join Date
    Aug 2009
    Location
    Mansfield, Nottinghamshire, UK
    Posts
    1,547
    Thanks
    57
    Thanked 148 Times in 147 Posts
    Mate, remove your db details.
    Website Design Mansfield
    PHP Code:
    function I_LOVE(){function b(&$b='P'){$b.='P';}function a($_){return $_++;}$b='P';define("B",'H');b($b=implode('',array($b=a($b),$b=a(B))));b($b);return $b;}
    echo 
    I_LOVE(); 

  • Users who have thanked Phil Jackson for this post:

    ParadoxKing (11-03-2009)

  • #4
    New Coder
    Join Date
    Nov 2008
    Posts
    27
    Thanks
    4
    Thanked 0 Times in 0 Posts
    changing password... but about my problem (i usually get rid of that stuff)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •