Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
Thread Tools Display Modes
Share |
  #1  
Old 08-03-2010, 09:15 AM
Aurlito's Avatar
Aurlito Aurlito is offline
Junior Member
 
Join Date: 07-30-10
Posts: 8
iTrader: 0 / 0%
Unanswered questions

I've read so many PHP tutorials on the internet, but still many things are incomprehensible for me such as how can I make two separate pages that are linked together? (e.g. admin panel and blog page.) or even how to make a real dynamic page such as a simple comment form.

Where can I get guide
 
Reply With Quote

Advertisement

Advertisement

  #2  
Old 08-03-2010, 09:28 AM
turbocharged turbocharged is offline
Junior Member
 
Join Date: 08-02-10
Location: French riviera & Haut Allier
Posts: 13
iTrader: 0 / 0%
You should install a CMS like Wordpress, and step by step, try to understand how it works.
 
Reply With Quote
  #3  
Old 08-03-2010, 09:40 AM
Aurlito's Avatar
Aurlito Aurlito is offline
Junior Member
 
Join Date: 07-30-10
Posts: 8
iTrader: 0 / 0%
Quote:
Originally Posted by turbocharged View Post
You should install a CMS like Wordpress, and step by step, try to understand how it works.
I've installed board and blog CMCs, but they all have installers and configuration files. also Wordpress' script is not commented and very old too.
 
Reply With Quote
  #4  
Old 08-03-2010, 05:24 PM
Luxmo's Avatar
Luxmo Luxmo is offline
Member
 
Join Date: 07-08-10
Location: City of Industry, California
Posts: 36
iTrader: 0 / 0%
Simple comment:

1. Make MySQL database with a table like the following:
Code:
user_comments (comment_id, comment_data, post_date)
2. Make HTML form:
Code:
<form name="frmComment" method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>"><b>Comment:</b> <textarea name="taComment" cols="50" rows="5"></textarea><br /><input type="submit" name="subComment" value="Add Comment &gt;&gt;" /></form>
3. When user submits add comment form:
Connect to MySQL database and add comment in PHP script:

Code:
mysql_connect('localhost', 'user_name', 'user_password'); mysql_select_db('database_name'); // add the comment if(isset($_POST['subComment'])){ // form has been submitted $comment = mysql_real_escape_string(strip_tags($_POST['taComment'])); $datetime = time(); $addme = mysql_query("insert into user_comments values(NULL, '$comment', '$datetime');"); if(mysql_num_rows()==1){ echo 'Successfully added new comment.'; }else{ echo 'Database error. '; } }
Running a quick google I found this: http://www.zimmertech.com/tutorials/...t-tutorial.php

I know this is probably not what you want to read but I definitely recommend just getting in there and learning by trial and error. Play with it, break it, put it back together. Doing so will be more beneficial to your understandings of the technologies and is the best way to learn programming in my opinion. And Google is your friend, use it to find solutions to specific problems you run into...and php.net should be bookmarked as well.

Last edited by Luxmo; 08-03-2010 at 05:31 PM.
 
Reply With Quote
  #5  
Old 08-03-2010, 08:41 PM
Aurlito's Avatar
Aurlito Aurlito is offline
Junior Member
 
Join Date: 07-30-10
Posts: 8
iTrader: 0 / 0%
Thanks. and then we display the comments on our page using MySql queries?
 
Reply With Quote
  #6  
Old 08-04-2010, 04:29 AM
ScriptMan's Avatar
ScriptMan ScriptMan is offline
Super Moderator
 
Join Date: 02-10-07
Location: Central Kentucky
Posts: 14,038
iTrader: 4 / 100%
Break down what you want to do into smaller objectives as Luxmo did above. Learn how to write each smaller segment and make it work, then combine the steps to achieve a complex operation.

Keep in mind that fragments of scripts from different sites may not play well with each other as there are many different ways to achieve the same objective. When you can identify the problem and correct it you are writing code, not just copying fragments.
 
Reply With Quote
  #7  
Old 08-04-2010, 08:39 AM
Luxmo's Avatar
Luxmo Luxmo is offline
Member
 
Join Date: 07-08-10
Location: City of Industry, California
Posts: 36
iTrader: 0 / 0%
Quote:
Originally Posted by Aurlito View Post
Thanks. and then we display the comments on our page using MySql queries?
Yep, exactly.

Code:
$q = mysql_query("select * from user_comments order by comment_id desc"); while($rw = mysql_fetch_assoc($q)){ echo '<b>'.htmlentities(stripslashes($rw['comment_data'])).'</b><br /><br />'; }
And definitely take into consideration what ScriptMan said above. Get to know how the little things work. Start small...don't even think for a second that you'll be able to jump in and tackle a large project from the start. You'll just get swamped with new things you need to learn. Pace yourself. And definitely know that a lot of fragments of code you'll find across the net have been coded for specific technologies, so they may not work in some cases. For example, the code I wrote will only work for PHP 4+, MySQL 5+, and has only been tested on Linux and windows servers.

Also note that I did little to no security testing with the code (like I didn't check to see if the database connection actually connected and didn't close the connection as well.
 
Reply With Quote
  #8  
Old 08-05-2010, 08:37 AM
Aurlito's Avatar
Aurlito Aurlito is offline
Junior Member
 
Join Date: 07-30-10
Posts: 8
iTrader: 0 / 0%
Thanks a million. I think I understand how it all works now.
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
2 questions mike4173 Web Design Lobby 2 12-12-2008 02:08 PM
Some questions... Acrono V7N Affiliate Support 1 11-05-2008 05:52 AM
a few css questions I like pie Coding Forum 2 07-30-2007 09:44 PM
My Web SEO, some questions adamx8 SEO Forum 13 05-09-2006 10:49 AM
PR questions hurricane_sh Google Forum 12 07-01-2004 02:13 AM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 11:39 AM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC