如何从数据库中存储和检索图像和描述,并使其能够由集合成员查看
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.
这是一个非常漫长而沉重的问题。 首先,我是PHP的新手,但我知道javascript和HTML以及CSS。 我创建了网页的静态元素,并设法将其与登录和注册premade php布局集成,因此目前用户可以注册并登录该网站。 然而,关键因素仍然存在; 用户应该能够从数据库中选择一个项目,并在选择时该项目应“固定”到特定的div。 p>
e.g。 用户点击“image.div”下方的按钮,当用户点击此按钮时,弹出一个模式弹出一些选项,用户必须选择一个选项,然后加载更多信息供用户查看。 获取此信息后,用户单击“pin”并关闭模式,并将该特定选项“固定”为“image.div”。 每个“image.div”都有自己的类别,例如 酒店,汽车租赁,餐馆等。当选择时,只有指定的类别由“image.div”显示。 p>
“固定”对象只能由固定的用户查看 当用户登录时。 p>
我还希望弹出模式中的选项可以通过关键字进行搜索,例如 金斯敦,纽约等。 p>
php登录脚本附带的数据库包含下表:fgusers 该表格包括以下列:id_user,name,email,phone_number,username和 密码。 p>
除了上述信息请求之外,我还想知道如何为此构建数据库,我应该扩展fgusers表吗? 或者我应该为每个表创建单独的表? p>
我们将非常感谢您的回复。 p> div>
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.