Getting blank when hyperlinking in PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hbhaskar
    New Member
    • Feb 2011
    • 3

    Getting blank when hyperlinking in PHP

    I used the following command to hyperlink
    Code:
    $result_id1 = mysql_query("SELECT * FROM query order by case_id");
    for ($i=0; $row1=mysql_fetch_array($result_id1); $i++)
    {
    //case_no is a field in the table "query"
    echo "<TD><b><a href='http://localhost/test/details.php?case=$row1[case_no]'> $row1[case_no]</a></b> </TD>";
    }
    now the file details.php is something like:

    Code:
    $case= $_REQUEST['case'];
    // after the connection and all
    $result_new = mysql_query("SELECT * FROM query WHERE case_no = '$case'") or die ("Error: ".mysql_error());
    $row=mysql_fetch_array($result_new);
    After i do this, I am getting a blank when i try to display a field of the table "date_rec"

    Code:
    echo $row[date_rec];

    please help me out asap...
    Last edited by Dormilich; Feb 28 '11, 03:05 PM. Reason: please use [CODE] [/CODE] tags when posting code
  • dgreenhouse
    Recognized Expert Contributor
    • May 2008
    • 250

    #2
    I don't see where you've referenced "date_rec" anywhere in your code.

    The following creates a valid link:
    Code:
    $row1['case_no'] = "hello";
    
    echo "<TD><b><a href='http://localhost/test/details.php?case=$row1[case_no]'> $row1[case_no]</a></b> </TD>";

    Comment

    • hbhaskar
      New Member
      • Feb 2011
      • 3

      #3
      see "case_id","case _no" and "date_rec" are the fields in the table "query"

      Comment

      • deric
        New Member
        • Dec 2007
        • 92

        #4
        Try this...
        Code:
        echo $row["date_rec"];
        Fetch a result row as an associative array, a numeric array, or both

        Comment

        Working...