我想获得点击的号码
并根据此编号从数据库加载数据。存储号码的列名为id。
我有这段代码才能显示数字(id)......
$sql = "SELECT id FROM work WHERE username='$username' order by id asc limit 10;";
$result = mysql_query($sql);
if ($result != 0) {
$num_results = mysql_num_rows($result);
for ($i=0;$i<$num_results;$i++) {
$row = mysql_fetch_array($result);
$id = $row['id'];
echo '<a href="' .kotoula(). '">' .$id. '</a>';
}
}
然后我想以表格代码为......
的形式从这个数字加载数据function kotoula() {
$username = $_SESSION["username"];
if($query = mysql_query("SELECT job_title,company,website,start_date,end_date,start_year,end_year,work_history FROM work WHERE id>'$id' AND username='$username' order by id asc limit 10") or die(mysql_error()))
{
if(mysql_num_rows($query)>=1){
while($row = mysql_fetch_array($query)) {
$job_title = $row['job_title'];
$company = $row['company'];
$website = $row['website'];
$start_date = $row['start_date'];
$end_date = $row['end_date'];
$start_year = $row['start_year'];
$end_year = $row['end_year'];
$work_history = $row['work_history'];
}
}
}
}
答案 0 :(得分:0)
只需使用GET将其放入网址即可。类似的东西:
http://yoururl.com/user.php?id=12345
然后,user.php将在$ _GET数组上接收该值。例如:
$_GET['id'];