ここで何が間違っているのですか!特定のクライアント ID に関連付けられているすべてのデータを表示したい
EXユーザー入力「2」
client_id "2" を持つすべての行が表示されます
<?php
if($_POST['submit'] == "submit"){
$username="xxx_admin";
$password="xxx";
$database="xxx_database";
//connect to mysql server
$mysqli = new mysqli("localhost", $username, $password, $database);
//check if any connection error was encountered
if(mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit;
}
$client_id = $_POST['client_id'];
echo $client_id;
$query = "select * from messages where client_id='$client_id'";
$result = mysqli_query($query);
$class_p = "timeling";
$clid_p = "oldupdate";
echo "<ol id=".$clid_p." class=".$class_p.">";echo $row->message;
while ($row = $result->fetch_object())
{
// set up a row for each record
echo "<li>";
echo $row->message;
echo "<br>" . $row->date_post;
echo "</li>";
}
echo "</ol>";
$mysqli->close();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<style type="text/css">
body
{
font-family:Arial, Helvetica, sans-serif;
font-size:14px;
}
.update_box
{
background-color:#D3E7F5; border-bottom:#ffffff solid 1px; padding-top:3px
}
a
{
text-decoration:none;
color:#d02b55;
}
a:hover
{
text-decoration:underline;
color:#d02b55;
}
*{margin:0;padding:0;}
ol.timeline
{list-style:none;font-size:1.2em;}ol.timeline li{ display:none;position:relative; }ol.timeline li:first-child{border-top:1px dashed #006699;}
.delete_button
{
float:right; margin-right:10px; width:20px; height:20px
}
.cdelete_button
{
float:right; margin-right:10px; width:20px; height:20px
}
.feed_link
{
font-style:inherit; font-family:Georgia; font-size:13px;padding:10px; float:left; width:350px
}
.comment
{
color:#0000CC; text-decoration:underline
}
.delete_update
{
font-weight:bold;
}
.cdelete_update
{
font-weight:bold;
}
.post_box
{
border-bottom:1px dashed #006699;background-color:#F3F3F3; width:499px;padding:.7em 0 2em 0;line-height:1.1em;
}
#fullbox
{
margin-top:6px;margin-bottom:6px; display:none;
}
.comment_box
{
display:none;margin-left:90px; padding:10px; background-color:#d3e7f5; width:300px; height:50px;
}
.comment_load
{
margin-left:90px; padding:10px; background-color:#d3e7f5; width:300px; height:30px; font-size:15px; border-bottom:solid 1px #FFFFFF;
}
.text_area
{
width:290px;
font-size:12px;
height:30px;
}
</style>
</head>
<body>
<div align="center">
<form method="post" action="">
Search:</br>
<p>client id: <input type="text" name="client_id"/> </p></br>
<input type="submit" name="submit" value="submit"/>
</form>
</div>
</body>
</html>
値を入力して [送信] をクリックしたときに得られるのはこれだけです
<html>
<head>
</head>
<body>
2
<ol id="oldupdate" class="timeling">
</ol>
</body>
</html>