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 7652129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:41:15+00:00 2026-05-31T11:41:15+00:00

I have an sql table named clients where each client is stored in a

  • 0

I have an sql table named clients where each client is stored in a row, with a unique (auto increment) id and the column names are: clientname, clientlastname, clientmobile and so on.

I want to make an array that will retrieve the contents of a specific client (row) and will be like : clientname => lalala, clientlasthname=>lalalala... and so on.

Then I want to display the results in an html form (non submitable, just display)
each cell in the form has a unique id and name same as the column names of the sql db.

I just new at it and cant seem to get it.
Here’s what I’ve done so far:

<?php
   header("Content-Type:text/html; charset=utf-8");
   if ($_POST) {
       $link = mysql_connect("localhost","userid","pw");
       if (!$link) { die("Database Connection Failed". mysql_error()); }
       mysql_set_charset('utf8',$link);
       $db_select = mysql_select_db("form2",$link);
       if(!$db_select){ die("Database Selection Failed " . mysql_error()); }
    }  else { echo "Search:"; }
?>

<html>
 <head> </head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

 <link rel="stylesheet" href="css/dsearch.css" />
 <link rel="stylesheet" href="css/base.css" />
 <link type="text/css" href="css/selected/jquery-ui-1.8.18.custom.css" rel="stylesheet" />
 <script language="javascript" type="text/javascript" src="js/jquery.min.js"></script>
 <script language="javascript" type="text/javascript" src="js/jquery-ui.min.js"></script>
 <script language="javascript" type="text/javascript" src="js/dropdowndata.sql/dropdowndata.clients.js"></script>
 <script language="javascript" type="text/javascript" src="js/buttons.js"></script>

 <body>
   <form class="form" id="dsearch" name="dsearch" action="dsearch.php" method="POST" enctype="application/x-www-form-urlencoded">
      <div class="dsearch"> 
        <li class="ui-widget"><label for="clients">client id: </label><input class="client" name="searchcid" style="width:100px" /></li>
        <li class="cell3"><input type="submit" value="Αναζήτηση" style="color:green; width:210px;  " /></li>
      </div>
   </form>
   <div class="results">


<?php
   $result1 = mysql_query("SELECT * FROM clients WHERE id='$_POST[searchcid]'", $link);
   if(!$db_select) { die("No Data found in db " . mysql_error()); };

   $items=array();
   while($row = mysql_fetch_array($result1)){
     $items[$row['id']] = $row['dlastname'];    

/* here is where I need the help I guess, 
   I need to fill the $items array with the data formatted as mentioned above.
   And after that I want to populate a form that I haven't already written with the
   values ,any help or maybe any suggestions on some tutorials I could go study
   would be appreciated.
   It goes on like this: */

   }
   print_r ($items);

?>

   </div>

  </body>
</html>
<?php
   if ($_POST) {
        mysql_close($link);
   }

?>

Edit: figured out how to get the array

$clinfo=array();
$clinfo=mysql_fetch_assoc($result1);            
print_r ($clinfo);

Now I need a way to go put the data where the field id equals the id of the docinfo array

  • 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-05-31T11:41:16+00:00Added an answer on May 31, 2026 at 11:41 am

    figured out how to do it with a little php and jquery,
    here it is:

    $(document).ready(function(){
    
         <?php
                if($_GET){
                           foreach($docinfo as $key=>$val) { 
                           echo "$('#" . $key . "').val('" . htmlspecialchars($val) ."');";
                           }
                   }
        ?>
    });
    

    This creates a jquery line for each cell id and fills it with the appropriate value

    Any comments or improvements are extremely appreciated

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Database (SQL Server) with table named 'ProcessData' and columns named 'Process_Name'
If I have a table field named 'description', what would be the SQL (using
I have a constraint (named INVS_ITEM_LOCATIONS_PK ) in my SQL Server 2005 table. How
MS SQL Server 2000 I have a column in Table A called Name. I
i want to make my table can filtering in each column. i get client
I have a Sqlite 3 and/or MySQL table named clients.. Using python 2.6, How
We have a SQL Server table containing Company Name, Address, and Contact name (among
I have the following table in SQL Server 2000: TABLE_NAME | COLUMN_NAME | TYPE_NAME
SQL Server procedure can return result sets. I have a table emp(emp__id, emp__name, ...)
I have a situation where I need to generate a table from a stored

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.