duandang6111 2013-05-19 06:11
浏览 37
已采纳

如何从数据库中存储和检索图像和描述,并使其能够由集合成员查看

This is a pretty long and hefty question. First off I am new to PHP but I know javascript and HTML as well as CSS. I have created the static elements of a webpage and have managed to integrate it with a login and signup premade php layout, so currently users can signup and login for the site. However the key element remains; the user should be able to select an item from the database and upon selection that item should be "pinned" to a specific div.

e.g. The user clicks on a button below "image.div", when the user clicks on this button a modal pops up with some choices, the user have to select a choice which then loads further information for the user to see. Upon getting this information the user clicks "pin" and the modal closes and that specific choice is "pinned" to "image.div". Each individual "image.div" will have it's own category, e.g. hotels, car rentals, restaurants etc. Ence when selected only the assigned category is displayed by "image.div".

The "pinned" object should only be view able by the user that pinned it when that user logs in.

I also want the choice within the popup modal to be searchable by keywords e.g. kingston, New York etc.

The database that came with the php login scripts have the following table: fgusers The table has the following columns: id_user, name, email, phone_number, username and password.

In addition to the above information request I would also like to know how to structure the database for this, should I extend the fgusers table? or should I create separate tables for each?

A response would be greatly appreciated.

  • 写回答

1条回答 默认 最新

  • doumu8911 2013-05-19 07:12
    关注

    If I understand your question correctly then, the best way to achieve the effect you are after is to use AJAX to access database info via a PHP script. Then use javascript to manipulate the xmlhttp result.

    As far as the MySQL database tables go, it is better to create separate tables for the different information. You will need to create a column in each table that references an identifying column in the table you want to link that particular tables information to.

    Then you just have to use the JOIN commands when referencing the table data.

    Example: if you want to link data to specific users you can add a username column to the table and add the users name to the data row. Later when you want to retrieve that users data, just reference the users name. If there are multiple tables of user data, use the JOIN command to link the tables together.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题