php怎么获取数据库中表的id

php怎么获取数据库中表的id,第1张

//首先配置数据库连接

mysql_connect("localhost","root","");

mysql_select_db("db");

mysql_query("set names 'utf8'");

//写sql语句并执行

$sql="select id from 表名 where 条件"; 

$query=mysql_query($sql);

$rs=mysql_fetch_array($query);

//打印

echo $rs['id']

mysql_select_Db("hedejiang");

先把大小写改了,

你也得告诉print_r($p);打印出什么来才好分析

<php

$p=$_POST['checkbox'];

print_r($p);

mysql_connect("localhost","hedejiang","hedejiang");

mysql_select_db("hedejiang");

$sql="select from `imusic` where `imusic_id` in (join(',',$p))";

$query=mysql_query($sql);

while($assoc=mysql_fetch_assoc($query)){

echo $assoc['imusic_name'];

}

>

1连接数据库 mysql_connect('localhost',‘root’,'123456');

mysql_select_db('dbname');

2提取特定id:$sql="select from table_name where id in(1,2,3)";

执行sql获得结果集,$result = mysql_query($sql);

$row = array();

3循环输出模板内容,

while($row=mysql_fetch_assoc($result)){

echo '<h3>'$row['title']'</h3>';

echo "<img src ='{$row[img]}'/>";

}

最下面的是你说的d出框是js特效,找个插件实现下就可以

你需要将 表一news 与 表二newsclass 用 classid 字段联系起来,进行查询:

select from news, newsclass where newsclassid=$_GET[classid] and newsclassclassid=newsclassid

既然是同一个页面, 可以用php生成一个html标签, 那也可以利用这个生成规则获取到里面的mallid的属性

比如mallid的属性是通过查询数据库得到或其他途径 那么你就可以再次利用这个途径获得

以上就是关于php怎么获取数据库中表的id全部的内容,包括:php怎么获取数据库中表的id、php数组获获取数据库相应id值、php语句,从mysql数据库表中提取特定id的内容,在特定页面输出。等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/9463667.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-28
下一篇2023-04-28

发表评论

登录后才能评论

评论列表(0条)

    保存