Explain, please, what to write in css, php, html files? Thank you in advance!
2 answers
Moving on a simplified scheme. First, the base, three tables.
The first (messages), where messages / products / news are stored: id(auto_increment), text
The second (comments), where comments are stored directly: id(auto_increment), msg_id, text, user_id
The third (users) where users are stored: id(auto_increment), name, login, password
HTML output:
//Π²ΡΠ±ΠΈΡΠ°Π΅ΠΌ ΠΈΠ· Π±Π°Π·Ρ Π²ΡΠ΅ ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΡ, Π·Π°ΠΏΡΠΎΡΠΎΠΌ ΡΠΈΠΏΠ°: select * from messages //Π²ΡΠ²ΠΎΠ΄ΠΈΠΌ Π² ΡΠΈΠΊΠ»Π΅ ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΡ <div class="message_body"> ΡΠ΅Π»ΠΎ ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΡ //Π²ΡΠ±ΠΈΡΠ°Π΅ΠΌ ΠΈΠ· Π±Π°Π·Ρ ΠΊΠΎΠΌΠΌΠ΅Π½ΡΠ°ΡΠΈΠΈ Π² ΡΠΎΠΎΡΠ²Π΅ΡΡΡΠ²ΠΈΠΈ Ρ ΡΠ΅ΠΊΡΡΠ΅ΠΉ Π½ΠΎΠ²ΠΎΡΡΡΡ. //Π·Π°ΠΏΡΠΎΡ ΡΠΈΠΏΠ° select c.text as text, u.name as user_name from users u,comments c where c.msg_id = 'id ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΡ' and u.id=c.user_id //Π²ΡΠ²ΠΎΠ΄ΠΈΠΌ ΠΊΠΎΠΌΠΌΠ΅Π½ΡΠ°ΡΠΈΠΈ Π² ΡΠΈΠΊΠ»Π΅ <div class="comment_body"> ΡΠ΅ΠΊΡΡ ΠΈ ΠΈΠΌΡ ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»Ρ </div> //Π·Π΄Π΅ΡΡ ΡΠΎΡΠΌΠ° Π΄ΠΎΠ±Π°Π²Π»Π΅Π½ΠΈΡ Π½ΠΎΠ²ΠΎΠ³ΠΎ ΠΊΠΎΠΌΠ΅Π½ΡΠ°, ΡΡΠΎ ΡΠΎ ΡΠΈΠΏΠ°: <div class="comment_add"> <form> <input type="hidden" value="id Π½ΠΎΠ²ΠΎΡΡΠΈ" name="msg_id"> <textarea name="text"></textarea> <input type="submit" value="Π΄ΠΎΠ±Π°Π²ΠΈΡΡ ΠΊΠΎΠΌΠΌΠ΅Π½ΡΠ°ΡΠΈΠΉ"> </form> </div> </div>
New PHP comment handler:
Check whether the user is authorized; if yes, we get its id, check for the validity of the information coming from the site, add a new comment to the database. user_id we have mgs_id arrived post'om, text too, id will be assigned.
CSS:
And here as the heart tells. We make beautiful, perverted to the fullest.
- I mixed up the names of the tables. - Oleg
Almost nothing if you use this tool.
- I know about it .. But it is desirable for me that everything be stored on my site! - Kamilplus
- oneThen I will answer your question like this: in css-, html-, php-files you need to write, respectively, css-, html-, php-code. I would also advise you to create a table comments in the database. The project is so serious that you do not trust disqus'u? Well, then you have half a hundred bucks to find a freelancer who will write you a block of comments. - caravaneer