Home>
Even layout is broken by the number of characters of the name extracted in the part of "echo"
Thanks for your professor.
<!-Read header->
<? php session_start ();?>
<? php require "header.html";?>
<? php
echo "<table>";
echo "<th>My Number</th><th>User Name</th><th>Price</th>";
$pdo = new PDO ('mysql: host = localhost;dbname = shop7;charset = utf8', 'staff', 'password');
if (isset ($_ REQUEST ["keyword"])) {
$sql = $pdo->prepare ("select * from product where name like?");
$sql->execute (["%". $_ REQUEST ["keyword"]. "%"]);
} else {
$sql = $pdo->prepare ("select * from product");
$sql->execute ([]);
}
foreach ($sql->fetchAll () as $row) {
$id = $row ['id'];
echo '<table>';
echo "<tbody>";
echo "<tr>";
echo '<th scope = "row">aaa</th>';
echo "<td>$id</td>";
echo "<td>", $row ['name'], "</td>";// part of the problem
echo "<td>bbb</td>";
echo "<td>bbb</td>";
echo "</tr>";
echo "</tbody>";
echo "</table>";
}
?>
.table
.table {
width: 100%;
margin-bottom: 1rem;
color: # 212529;
}
I want to apply it to the top line like the second gray space from the bottom, but I can't confirm the regularity.
It is in a stopped state.
* If i increase the number of characters in the part that contains the product name after "1", the number of blank lines, which are gray parts, increases accordingly.
OS: mac
I am using bootstrap4 and reading it.
-
Answer # 1
-
Answer # 2
prepare ("select * from product where name like?"); $sql->execute (["%". $_ REQUEST ["keyword"]. "%"]); } else { $sql = $pdo->prepare ("select * from product"); $sql->execute ([]); } $rows = $sql->fetchAll (); ?>
My number username Price aaa bbb bbb
Related articles
- python 3x - how to count the number of data extracted by pandas or how to solve the error
- [c language] add line number and number of characters in the line to standard input
- [difference in processing speed depending on the number of elements in the array] i would like to know why the larger the number
- php - get the number of integer characters
- python 3x - a program that outputs the type and number of characters contained in a character string
- php - i want to delete unnecessary characters in the phone number retrieved from the database using the hp method
- i want to know the number of characters in a char type array
- python - assign the number of characters of each element of dataframe to dataframe
- c ++ - i want to count the number of same characters
- css animation: i want to display svg and characters fixedly on the slide image
- php - i want to limit the number of characters in the title of the "previous article" and "next article" nav
- python - i want to limit the number of images to be extracted
- is 3 characters appropriate for the number of characters in the go language receiver name?
- i set an automatic serial number with css, but one number is skipped
- css - i want to make the characters become vertical when placing tabs horizontally in qt, and i want to set a background image
- python - display the number of characters in the list in dictionary format
- mysql - when pasting an index with sql, "column with short number of characters in multiple languages" or "column
- model - difference in results depending on the number of cnn convolutional layers
- ruby - how to check the number of characters
- JS implementation to find the most occurrences of characters in strings and the number of examples
Trends
Make a mock with static html instead of making it suddenly with php, then adjust the shape with php.
If you can't create static html, you can't get the expected layout from php.