Jump to content

Display Tables in Mysql and Search using PHP


xmark02

Recommended Posts

Hi Guys,

 

Need help, I'm newbie in PHP.

this is my first time to create my own php.

 

Content of Questions:

 

1. Displaying Data from MySQL to HTML using php

        * Refer Search DATA.png

 

Can you help me how to view the tables in HTML, everytime I click search it's loading to another page and displayed the tables

the thing I want to see is to view/display the table in html.

 

hope you can help guys.

 

THank You.

 

 

 

 

 

post-192626-0-07456000-1458198012_thumb.png

post-192626-0-99445100-1458198019_thumb.png

search_filtering.php

Edited by xmark02
Link to comment
Share on other sites

What code are you using to query your database?

<?php

$conn = mysqli_connect("localhost", "yourusername", "yourpassword") or die(mysqli_error($conn));
mysqli_select_db($conn, "yourdb") or die(mysqli_error($conn));

$client = $_GET['client'];


$query = "select * from tablename where client='$client'";

$result = mysqli_query($conn, $query);

$count = mysqli_num_rows($result);
if($count==0)
{
    echo "No Results Found";
} else {
   $table = '<table>';
   while($array=mysqli_fetch_array($result))
   {
       $table .= '<tr><td>' . $array['name'] . '</td><td>' . $array['otherdetail'] . '</td></tr>'

   }
   $table .= '</table>';
}

echo $table;

?>

or something like that anyway is what you will need to write to query a database and generate a html table to be output into the browser

Edited by drewdan
Link to comment
Share on other sites

Hopefully you sanitize the GET variable before using it in your query. Basic security!

 

Also - if you do already have code you should show us the RELEVANT area that you are having a problem. Many of us don't go to other sites to see possibly malicious pages. See the Rules.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.