Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7732623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:46:37+00:00 2026-06-01T06:46:37+00:00

Sorry, newbie question I know, however I’ve currently got mySQL results only showing when

  • 0

Sorry, newbie question I know, however I’ve currently got mySQL results only showing when using the echo command through PHP etc..

Now, I am able to source the information fine, however I would like the result of a query to show up in a form e.g.

Rather than :-

    $loggedinuser = $session->username;

    //$query = "SELECT surname, firstname FROM PASSENGER WHERE username = '$jared'";
    $query2 = "SELECT p.surname, f.destination FROM PASSENGER p, FLIGHT_INFO f WHERE p.username = '$loggedinuser' AND p.flightNo = f.flightNo";
    $result = mysql_query($query2);  
    while($row = mysql_fetch_array($result))
{
echo $row['surname'] ." ". $row['destination'];
}

    echo mysql_error();

I would like to print the SQL result in a HTML form…e.g. one that follows the convention of:-

    Surname: <input type="text" name="firstname" value="echo $row['surname']/>

If you see where I am coming from. Is this really bad practice using forms to display mySQL results, or can it be done? If not really, what ways would you recommend I print the data? In a table of some sort, but how can I then use fields?

Regards,

Tom.

Something like this work:-

                            <?php

                    $loggedinuser = $session->username;

            //$query = "SELECT surname, firstname FROM PASSENGER WHERE username = '$jared'";
            $query2 = "SELECT p.surname, f.destination FROM PASSENGER p, FLIGHT_INFO f WHERE p.username = '$loggedinuser' AND p.flightNo = f.flightNo";
        $result = mysql_query($query2);  
    while($row = mysql_fetch_array($result))
    {

  "<form>"
  <input type="text" name="firstname" value="<?php echo {$row['surname']} ?>" disabled       />
     "</form>"
           }
               echo mysql_error();
       ?>

How can a new line be added between echo’s in the following code please?

                echo ' Surname: <input type="text" name="surname" value="'.$row['surname'].  "\" disabled /> ";
        echo 'Forename: <input type="text" name="surname" value="'.$row['forename']. "\" disabled />";
        echo 'Email Address: <input type="text" name="surname" value="'.$row['emailAddress']. "\" disabled />"; 
        echo 'Preference ID: <input type="text" name="surname" value="'.$row['dob']. "\" disabled />"; 
        echo 'Seat Number: <input type="text" name="surname" value="'.$row['seatNo']. "\" disabled />"; 
        echo 'Group ID: <input type="text" name="surname" value="'.$row['groupID']. "\" disabled />"; 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T06:46:38+00:00Added an answer on June 1, 2026 at 6:46 am
    <input value="<?php echo $row["firstname"]; ?>">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm sorry for the question but I am terribly a newbie in using MySQL
I am a MySQL newbie, so sorry if this is a dumb question.. These
Sorry for asking such a newbie question, I know it makes a few of
sorry im a newbie, i dont know if i am asking the right question,
Sorry if this is a newbie question. I have searched but found nothing... Using
I am sorry for my newbie question, but I do not know much about
sorry for a newbie question.. but Service by it's defenision meaning the same as
Sorry for this newbie question, but I can't find on google what I need
I'm really new to VSTO so sorry if this is a newbie question. I'm
I`m a total newbie in php, so sorry for my simple question. Need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.