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

    Join Date
    Dec 2012
    Posts
    25
    Rep Power
    0

    Error in script but cant see where?


    Hi, I have an error somewhere in this script but i cant see where im going wrong.

    Can anyone point me in the right direction.

    its a script to allow the edit of some feilds.

    PHP Code:
    edit.php
    <?php
    $host 
    "localhost"
    $user "x"
    $pass "x"
    $dbname "x";

    $connection mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error()."<BR>"); 
    mysql_select_db($dbname);

    $PCN $_GET['PCN']; 
    $results mysql_query("select PCN, REG from selfticket where PCN = $PCN"); 
    $row mysql_fetch_row($results); 

    echo 
    $row[PCN];
    ?>
    PHP Code:
    <a href="edit.php?PCN=<?php echo $row['PCN']; ?>">Edit</a>
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,464
    Rep Power
    594
    The first error is using the deprecated MySQL extensions. You should be using PDO.

    The second error is you assuming anyone here is clairvoyant and knows what error message you are getting or what is not working.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    25
    Rep Power
    0
    I was getting a blank output or "array"

    the problem was located in mysql_fetch_row which should have been mysql_fetch_assoc


    thanks anyway.

IMN logo majestic logo threadwatch logo seochat tools logo