using two tables with mysql
$sql = "SELECT * FROM `basic` WHERE id = 2 LIMIT 0, 30";
i want to retrieve data from 'users' table in the same query. fields of users table are
1.country
2.name
3.userid
basic table consist of selling items and there are unique id for each one. also users table consist of users and there are uni开发者_运维百科que id for each one.
if i say i want data from basic table where id is 4 and user's table where id is 15 in same query....how should i rewrite above mysql statement
May be you need to read this JOIN.Try to read some tutorials that can help you improving your programming knowledge.
$sql=SELECT *
FROM `basic` as b inner join `table2` as c
WHERE b.id =c.id
精彩评论