![](/img/trans.png)
[英]Show MySQL row content on PHP from specific table column (same .row name on different tables)
[英]Show specific row from table
我有一個表table1
id | name | age | emailid
-------------------------------
1 | abc | 24 | abc@gmail.com
2 | abc | 35 | abc@gmail.com
3 | abc | 23 | abc@gmail.com
我的PHP代碼是:
<?php
require"connection.php";
$email=$_SESSION["email"];
$qry=mysql_query("select * from user_new_history where email='$email' order by id ASC") or die(mysql_error());
while($qry1=mysql_fetch_array($qry))
{
if($count<1)
{
echo $id;
}
}
?>
它給出了最后兩行。 但是我只想顯示第二行。 怎么可能呢?
請幫忙。
您使用電子郵件查找用戶,並且您有3個具有相同名稱和電子郵件的用戶。
您必須設置唯一的“電子郵件”和“名稱”字段。
然后,您可以找到用戶。
在SQL中執行:
select * from user_new_history where email='$email' order by id ASC LIMIT 1,1
嘗試這個:
<?php
require"connection.php";
$email=$_SESSION["email"];
$qry=mysql_query("select * from user_new_history where email='$email' order by id ASC") or die(mysql_error());
$count = 1;
while($qry1=mysql_fetch_array($qry))
{
if($count == 2)
{
echo $id;
}
$count ++;
}
?>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.