简体   繁体   中英

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. Each have Add, View, Edit & Delete pages.

Table: aspect has rows ascode & asname .

Table: aspectdet_1 has rows Dept_Code , ascode , astype , cndtn & asscope .

I want to display asname from Table: aspect in Table: aspectdet_1 's view page. 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.

You can check the database table privileges in your Phpmyadmin

A nice tutorial about privileges: http://dev.mysql.com/doc/refman/5.1/en/privileges-provided.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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