Showing posts with label programmer. Show all posts
Showing posts with label programmer. Show all posts

06 March 2016

How to create comments system using PHP and MYSQL

Hello Programmers this is my first lesson in PHP and it talk about how to make and create system comments to your website or any websites you want. All forums use this system and the most of websites.

how,to,create,comments,system,make,comment,php,mysql,database,table,website,forum,blog,wordpress,programmer,lesson
create comment system by using PHP and Mysql @wikihard



I wish you take advantage of the lesson and learn more about PHP programming.

Notice : All big websites use COMMENTS SYSTEM like Facebook, Twiter and google plus.

Facebook Example :

how,to,create,comments,system,make,comment,php,mysql,database,table,website,forum,blog,wordpress,programmer,lesson
Simple System comments of the Facebook @wikihard

Google+ plus Example :

how,to,create,comments,system,make,comment,php,mysql,database,table,website,forum,blog,wordpress,programmer,lesson
Google plus comment @wikihard

Google and Facebook are using Javascript, but in this topic I will show you how to create a simple system commenst by using PHP & MYSQL only, I need you to learn the basic, then you can improve it yourself!

firstly you must to create a php file called connect.php and put the script bellow in, This file will help us to manipulate between the website and database without any problem.

  Connect.php File :


<?php

$user='username';

$user='username'; 
$pass='password'; //@wikihard copywrite

$host='localhost'; // if you have a web hosting change this infos


$database='public';

mysql_connect("$host", "$user", "$pass")or die("cannot connect");

mysql_select_db("$database")or die("cannot select DB");


?>

Read more :  3 ways to learn PHP on your own
Read more :  9 tips to become better in programming 

When you finish connect.php file, we will start to create new important file called index.php, we will use this page to display our comments and to add more comments too.


<?php

require_once('connect.php');
$message ='';
if(isset($_POST['submit']))
{
if(!empty($_POST['comment']) && !empty($_POST['name']))
{

//created by @wikihard
$comment= $_POST['comment'];
$name= $_POST['name'];
$query = "INSERT INTO `comment` VALUES(NULL,'$name','$comment')";
$qresult = mysql_query($query);
$message="Thank you for comment!";

} else
{
$message="please don't let area empty!";
}

}

$sql = "SELECT * FROM `comment`";
$qsql = mysql_query($sql);




?>
<!DOCTYPE html>
<body>
<?php
while ($row = mysql_fetch_array($qsql))
{
echo "<b>".$row['name']."</b> : </br>";
echo " ".$row['comment'].". </br></br>";
?>
<form method="post" action="index.php">
<input type="text" name="name" placeholder="put your name"></br></br>
<textarea rows="5" cols="25" name="comment" placeholder="write your comment here"></textarea></br></br>
<input type="submit" name="submit" value="post comment">
</form>
<?php echo $message;?>
</body>
</html>


 How it work :


      - First we must call the connect.php file to connect with the database!

      - When we add value and press the button "Add comment", the comment will send and save in the comments table(id,name,comment) in the database.

      - if the fields are empty, will NOT WORK and this message will show for the user "please don't let area empty " Until he put values before submitting.

      - Now we need to display all comments from the database (comments table) to the home page ( index.php ).

      Any question please let a comment! Good luck

      01 March 2016

      9 tips to become better in programming

      Whether you are a complete beginner or experienced programmer, here are 9 Tips to get better programming and coding. Try to apply a maximum in everyday life to get real results.

      9, tips, to, become, better, programming, coding, computer, programmer, experience, language, writing, guide, programs, fun, learn,
      tips to become better programming - @wikihard  

      It is easy to know the keywords of a programming language, it is easy to copy a code found on the Internet, but this program is much more than writing lines of code.

      Read more : 3 ways to learn PHP on your own
      Read more : A series of steps in order to become a successful programmer
      Read more : Women encode better than men, According to this study 

      Here are 9 tips to become better programming:

      1. Programmer into a tall way of learning :

      Programming is registered in the "know-how" of our memory. This part takes practice. Practice also helps to make mistakes, just to not repeat them in the future.
      Programming is learn a lot by doing, and you do, the more you know.


      2. Read books and guides

      Before applying the previous point it obviously takes a minimum of bases. These bases are searching in books for programming languages ​​in question. Resources are many on the Internet, do not hesitate to buy a practical guide to start on better footing.


      3. To contribute or ask questions

      Especially in the open source community, the members are very active and willing to answer the questions. Try all the same to look forward to your questions.


      4. Think well

      Programmer's not that type of code from its keyboard. There are principles to learn before diving into the code: The data structures and algorithms. This is surely the most irksome part of learning because it is good in mathematics and theoretical, but this step lets you organize your programs properly and thus develop faster.


      5. Read and use examples

      Whether on blogs or in other people's code, inspire you to what exists for the continue or better. You do not need to reprogram all that exists for each new program.
      This is a typical beginner mistake: Want any program from scratch. Although the desire to know everything in the background is a very positive point, you never get any program or learn from scratch. And if you do not believe me, start to learn assembler and try to keep going every day. The goal of the program is to understand the functioning of the systems and write programs that solve a problem, not to spend hours making what already exists, and better ... or worse.


      6. Join the community of programmers

      Sharing knowledge is very important to move forward and advance the other. If you have the opportunity to do a project with others, while being advised, you will gain a lot in productivity.
      Sites like StackOverflow have a very active community that almost instantly respond to requests.


      7. Test your programs

      The best way to miss now and later to produce programs that are not fully functional, very memory hungry or just little optimized. Being satisfied with a non-functional program and continue well does not help to do better in the future. You have to stand on the side of the programmer but also on the user side.



      8. Helping others

      Helping others is to learn programming while providing a service. Teach someone is a great way to learn because:
      Either we already know and rewriting what we learned (repetition is a great way to burn things in our memory).
      Either at the same time we try and learn.


      9. Be passionate, fun programming

      Perhaps one of the most important points, at least for me. Look, almost all major projects that exist have been established by passionate people.

      Unable to achieve something 100% free love to. Guess what, the websites for learning by playing, or vice versa to learn to program games are very popular.


      PS: If you now decide to learn a programming language, what language do you learn? And why it's instead of another? Put it in a comment!

      9, tips, to, become, better, programming, coding, computer, programmer, experience, language, writing, guide, programs, fun, learn,

      Women encode better than men, According to this study

      According a study in the United States by Caly Poly women would write the best code compared to men. This study was conducted using data from millions of users of the Github software.

      according, this, study, women, encode, better, than, men, coding, programming, computer, software, language, programmer,
      Women encode better than men, According to this study
      Still under revision, the study showed that the "pull request", suggestions for changes to software code (often open source), are more likely to be accepted when they come from women.

      78.6% of the "pull request" made by women have been accepted, while among coders, this acceptance rate was 74.6%.

      Over 25% of women have a rate of 100% (all suggestions are accepted) while males, only 13.5% can claim such a score.

      Sexism?

      However, it is also suggested that the changes made by women are more likely to be accepted if they use profiles on which the genus is hidden.

      When the key propose an amendment as "outsider" on a project, so when the project do not know, and they use profiles on which the genus is not indicated, the acceptance rate is 71.8%.

      But when it comes to an outsider whose kind is clearly identifiable, this rate is only 62.5%.

      Researchers evoke an "apparent sexism" and explained that although a difference is also found in men, it is of less importance.

      To identify the kind users who chose to not indicate this on their profiles, the researchers had to analyze them to see if it is a man or a woman, for example searching profile linked to the email address on social networks.


      Source : Presse Citron

      28 February 2016

      3 ways to learn PHP on your own

      Today I want to give you a powerful and easy ways to learn PHP programming on your own and without loss your money by purchase courses, to learn PHP as soon as possible you need to love this language and to practice it in anytime you feel bored, my personal ways let you learn PHP programming with yourself in a professional manner and without need help of others.

      ways,to,learn,php,on,your,owen,programmer,programming,developer,courses,professional,free,tutorials,php,guide
      3 ways to learn php on your own - with yourself - @wikihard



      These methods are from my long experience in PHP and Web developing in general.

      Before we start you must remember this things :


      •  Be careful to stop or fail ( maybe you feel this language is different or hard!)
      •  Remember always this sentences " Everything is easy, just you need to make it simple! "
      •  if you really want to be a professional PHP programmer, you need at least 1 year of experience and practicing PHP.
      •  PHP is very big space, because everyday you will learn something new, so you never say I know everything about PHP and try to learn more even you can make a lot of dynamic websites !
      • Always there are a lot of methods to solve your problem.
      • Be different !


      3 way to learn PHP with yourself:


      Read more : A series of steps in order to become a successful programmer

      1. W3Schools 

      ways,to,learn,php,on,your,owen,programmer,programming,developer,courses,professional,free,tutorials,php,guide
      3 ways to learn php on your own -  @wikihard

      w3Schools is from the best websites to learn programming languages, you only need to register and start, but you must understand all classes and practice it with yourself. when you sure that you understand everything. leave it! or start to learn another language like JavaSkript.
      website : www.w3schools.com


      2. CodeCademy 

      ways,to,learn,php,on,your,owen,programmer,programming,developer,courses,professional,free,tutorials,php,guide
      3 ways to learn php on your own -  @wikihard

      Code Cademy is like W3Schools, the different thing is the learning way so when you use codecademy you have more ideas about PHP programming .
      website : www.codecademy.com



      3. Coursera 

      ways,to,learn,php,on,your,owen,programmer,programming,developer,courses,professional,free,tutorials,php,guide
      3 ways to learn php on your own -  @wikihard

      Coursera is your way to learn more advanced methods, you only need to download all free PHP tutorials, You can use Youtube too but try to download only the long courses.
      website : www.coursera.com



      Resume 

      if you follow exactly my steps, I'm sure you will start making different websites in short time, Patient is your power point and practices to advance.
       


      10 February 2016

      A series of steps in order to become a successful programmer

      Many coders looking for success, professionalism and they ask themselves always, how do I become a professional?



      I'll put you some key points which leads to professionalism :
      1. extension programming as possible
      2.  do not programmed each script from zero
      3. if you are a professional designer doesn't mean you are a professional programmer
      4. the rise of the stairs is step by step
      5. Tradition is the best way to success
      6.  finally: If you cannot do a certain order ask
      programmer always need to ask, search, you can use Google for searching and try to find a good groups in Facebook and social network you can improve your skills with them!