html - php border around table -


i have php script output 2 rows of data. possible add border around table , components(tr,td) in php? add border css in style element.

this code:

<!doctype html> <html> <head> <style> td { border-style: 1px solid black; }  </style> <meta charset="utf-8"> <title>oef2</title> </head> <body>  <?php $host = "localhost"; $user = "*******"; $password = "*******"; $database = "elektrowinkel";  $link = mysqli_connect($host, $user, $password) or die("er kan geen connectie gelegd worden met $host");  mysqli_select_db($link, $database) or die("databank $database niet beschikbaar");  $query = "select * stock_magazijnen";  $result = mysqli_query($link, $query) or die("er een fout opgetreden bij het uitvoeren van de query: \"$query\"");  $aantalrecords = mysqli_num_rows($result);  echo("<table><tr><th>magazijn_id</th><th>product_id</th><th>aantal</th></tr>");  while($rij = mysqli_fetch_array($result)) {     echo("<tr>                 <td>".$rij['magazijn_id']."</td>                 <td>".$rij['product_id']."</td>                 <td>".$rij['aantal']."</td>         </tr> "); } echo("</table>");  mysqli_close($link);  ?> 

if want have <td>'s have border, (while changing border-style border):

<style> td { border: 1px solid black; } </style> 

if want entire table , <td>'s have border, add table in declaration

<style> table, td { border: 1px solid black; } </style> 

if want border around table not <td>

<style> table { border: 1px solid black; } </style> 

Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -