Under the php condition, how does one click the record name on the left and the specific content is displayed on the right of the page? I made a webpage. the column on the left is the record name displayed one by one. it is read from mysql through a loop statement and displayed in each row. The right side is the specific content framework of each record (that is, many blank boxes ). To achieve this goal, click any record name on the left. in the empty boxes on the right, you can see how to click the record name on the left under the php condition, what is displayed on the right of the page?
I made a webpage. the column on the left is the record name displayed one by one. it is read from mysql through a loop statement and displayed in each row. The right side is the specific content framework of each record (that is, many blank boxes ). The goal is to click the name of any record on the left, the specific content of the record is displayed in the empty boxes on the right (in fact, the content of each field is filled in each blank box ).
What simple framework should be used to implement the record name on the left? Then, what variables are passed to control the reading records and read the specific records from mysql? (it seems that this record content is not difficult to display in various empty boxes, can I do this )? Of course, the specific content of each record already exists in mysql. you can query it.
Please help me more. this is the first time I have asked, it's urgent. Thank you. Share:
------ Solution --------------------
Demo address http://www.colg.biz/demo/d1.php
Code
Display Page
header("Content-Type:text/html;charset=utf-8");
mysql_connect('localhost','colg_demo','colg__');
mysql_select_db('colg_demo');
function getdata($sql)
{
$result=mysql_query($sql);
if($result)$count = mysql_num_rows($result);
for($i=0;$i<$count;$i++)
{
mysql_data_seek($result,$i);
$data[$i] = mysql_fetch_assoc($result);
}
return $data;
}
$data = getdata("select * from demo");
?>
.left{float:left;width:100px;border:1px solid grey;height:300px;}
.right{float:left;width:800px;border:1px solid grey;height:300px;margin-left:15px;}
.left_button{margin:5px;border:1px solid #ccc;cursor:pointer;}
td{margin:1px;border:1px solid #ccc;}
《script》
$(document).ready(function(){
$(".left_button").click(function(){
$(this).css("background","#EEE");
$(this).siblings().css("background","white");
var n = $(this).text();
$.ajax({
type:"get",
url:"ajax.php",
data:{
n:n
},
success:function(msg){
msg = eval("("+msg+")")
$(".show_tr").html(msg);
}
});
});
});
《script》