php help on rows display

Discussion in 'PHP' started by rogerbeta, Apr 18, 2010.

  1. #1
    I have a file with 20 large fields

    I have 3 different keys
    polno agenno conname
    for any key that is not blank I will select those rows that will show 5 identifiable fields


    after I display the rows

    I want the user to click on any row
    and then show the 20 fields in one page for each record



    // Display the text of each record in a paragraph
    while ( $row = mysql_fetch_array($result) ) {
    echo(. $row["PolNo"] . " " . $row["AgenNo"] . " " . $row["ConName"] . );
    }


    What is the code to go from the display of the row to the individual record

    Thank you
     
    rogerbeta, Apr 18, 2010 IP
  2. twhiting9275

    twhiting9275 Active Member

    Messages:
    305
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    80
    #2
    the best answer is to build the text THEN display it, something like this:
    
    // Display the text of each record in a paragraph
    $thedisplay = "";
    while ( $row = mysql_fetch_array($result) ) {
    $pollno=$row['PollNo'];
    $agenNo=$row['AgenNo'];
    $ConName=$row['ConName'];
    $thedisplay .="$pollno <a href=\"yoururlhere\">$agenNo</a> $ConName<br />";
    }
    print ($thedisplay);
    mysql_free_result($result);
    
    PHP:
    Look where I put the href stuff, change it as you like.
    I'd also suggest a css based field for each of those, something that will standardize the display, so you don't have the fields going everywhere, unless every field is going to have the same exact length.
    Good luck!
     
    twhiting9275, Apr 18, 2010 IP
  3. rogerbeta

    rogerbeta Well-Known Member

    Messages:
    174
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    108
    #3
    Thank you for your help.
    I do no want to display data from a url but all of the fields from the selected row.
     
    rogerbeta, Apr 19, 2010 IP
  4. s.ham

    s.ham Member

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #4
    construct a table with table,tr,th,td tags in your script.
     
    s.ham, Apr 21, 2010 IP