简体   繁体   English

如何在php中从一个数据库表显示数据到另一数据库表的视图页?

[英]How to display data form one db table to another db table's view page in php?

I have 2 db tables aspect & aspectdet_1. 我有2个数据库表Aspect和Aspectdet_1。 Each have Add, View, Edit & Delete pages. 每个都有添加,查看,编辑和删除页面。

Table: aspect has rows ascode & asname . 表: aspect具有行ascodeasname

Table: aspectdet_1 has rows Dept_Code , ascode , astype , cndtn & asscope . 表格: aspectdet_1具有Dept_Codeascodeastypecndtnasscope

I want to display asname from Table: aspect in Table: aspectdet_1 's view page. 我想在表: aspectdet_1的视图页面中从表: aspect显示asname I used the code 我用了代码

$query="SELECT aspectdet_1.Dept_Code, aspectdet_1.ascode, aspectdet_1.astype, aspectdet_1.cndtn, aspectdet_1.asscope, aspect.asname ".
    "FROM aspectdet_1, aspect ".
    "WHERE aspectdet_1.ascode = aspect.ascode ";

It works in view page. 它可以在视图页面中使用。

But when I want to edit or delete that pages not supporting. 但是当我要编辑或删除不支持的页面时。

Is that code right? 该代码正确吗?

What to do for edit & delete? 如何进行编辑和删除?

Sounds like database privilege problem. 听起来像数据库特权问题。 Please make sure whether mysql-user you used to connect to the databases (used in mysql_connet) has edit and delete privileges for the tables. 请确保用于连接数据库的mysql用户 (用于mysql_connet)是否具有表的编辑和删除权限。

You can check the database table privileges in your Phpmyadmin 您可以在Phpmyadmin中检查数据库表特权

A nice tutorial about privileges: http://dev.mysql.com/doc/refman/5.1/en/privileges-provided.html 一个有关特权的很好的教程: http : //dev.mysql.com/doc/refman/5.1/en/privileges-provided.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM