Code for writing the comment to the DB

Now create a new page called ‘addcomment.php’

<?php
$conn = mysql_connect('localhost', 'username', 'password');
mysql_select_db('yourdb');

$comdate = $_POST['comdate'];
$articleid = $_POST['articleid'];
$comsubject = htmlspecialchars(addslashes($_POST['comsubject']));
$comuser = htmlspecialchars(addslashes($_POST['comuser']));
$comtext = htmlspecialchars(addslashes($_POST['comtext']));

//write the query
$sql = "insert into comments(comdate, articleid, comsubject, comuser, comtext)";
$sql .= " values ('" . $comdate . "', " . $articleid . ", '" . $comsubject . "', '" . $comuser . "', '" . $comtext . "');";

if (!@mysql_query($sql)) {
  echo ('We are unable to register your comment, sorry');
} else {
  echo ("Your comment was added successfully<br>");
  echo ("<A HREF="article.php">Back to Articles</A>");
}

mysql_close($conn);
?> 

User Interface for adding comments

Now that we have had some article in our dB, it is now time to show the article to the world. Plus we need to show the comment to them

Let us make a page called as ‘article.php’ and the article is fetched by getting the a url as ‘article.php?articleid=1’ This will fetch the article # 1 and is stored in the DB as articleid=1

If the articleid query is not given then the page has to display all the aritcle listing with the article subject as an link to ‘article.php?article=[the articleid]’

<?php
//if articleid query is not set, show all the article listing
if (!isset($_GET['articleid'])) {

$conn = mysql_connect('localhost', 'username', 'password');
mysql_select_db('yourdb');

$sql = "select * from articles;";
$result = mysql_query($sql);

echo('<table boder=0 cellpadding=3 cellspacing=1>');
while ($row = mysql_fetch_assoc($result)) {
  echo('<tr>);
  echo('<td>);
  echo('<a href="aricle.php?articleid='.$row['articleid'].'"><b>'.$row['articlesubject'].'</b></a>');
  echo('<tr>);
  echo('<td>);
  echo($row['articlesubject']);
}
echo('</table>')
mysql_close($conn);

} else {

$conn = mysql_connect('localhost', 'username', 'password');
mysql_select_db('yourdb');

$sql = "select * from articles where articleid=" . $_GET['articleid'] . ";";

if (!($result = @mysql_query($sql))) {
  echo('Sorry We are not able to process your request');
} else {
  //now display the data
  $row = mysql_fetch_assoc($result);
  echo ("<p><b>" . nl2br(htmlspecialchars($row['articlesubject'])) .
"</b>");
  echo ("<p>".nl2br(htmlspecialchars($row['articletext']))."<p>");
?>

  Add Comment
  <table>
  <form name='comment' action'addcomment.php' method=post >
  <input type=hidden name='comdate' value="<?php echo(date("Y-m-d H:i:s"))?>">
  <input type=hidden name='articleid' value="<?php echo($_GET['articleid'])?>">
  <tr><td>
  Subject<input type=text name='comsubject' />
  <tr><td>
  User<input type=text name='comuser' />
  <tr><td>
  <textarea name='comtext' rows=15 cols=50></textarea>
  <input type=submit value='Post Comment' />
  </form>
  </table>

<?php
  //now show all the comments for this article
  
  $sql = "select * from comments where articleid=" . $_GET['articleid'] . ";";   $result = mysql_query($sql);
  if (mysql_num_rows($result)<1) {
    echo('No comments posted for this article');
} else {
    while ($row = mysql_fetch_assoc($result)) {
      echo('<p>');
      echo( htmlspechialchars(stripslashes($row['comsubject'])) . ' by ' . htmlspechialchars(stripslashes($row['comuser'])) . ' on ' date("d M Y h:i a", strtotime($row['comdate'])) . '<br>');
      echo( nl2br(htmlspechialchars(stripslashes($row['comtext']))) );
    }
  }
  mysql_close($conn);
  }

}
?>

This now completes the code for viewing the article, the page also displays a form which as a subject textbox, a username textbox and a textarea for comment text.
When user clicks the ‘Post Comment’ button, the data is ‘post’ fed to the page ‘addcomment.php’

Creating tables

The first and most important charecteristic for such type of a system is that the article whatever it may be must be in a database with an articleID associated with it.

So first create an table for an article like this

# Create a table for articles over here
create table articles (
  articleid int(5) primary key auto_increment,
  articlesubject varchar(255),
  articletext text
);

Once done with creating the articles table you need to create a posting table where user can post comments on the article. For that create a table as comments as follows

# Create a table for comments
create table comments (
  comid int(5) primary key auto_increment,
  articleid int(5),
  comsubject varchar(255),
  comuser varchar(255),
  comdate datetime,
  comtext text,
);

Here the articleid is the foreign key, don’t worry about foreign or home. It is just to link the comment to what article. The date time records the date, time in “YYYY-MM-DD HH:MM:SS” format.
comtext is a text field and can store big text values.

Now once you have created the table for article, it is time to fill some values into them let us fill some easy values into it.

> insert into articles(articletext) values ('This is some easy article and is for some testing purpose only');
> insert into articles(articletext) values ('This is another easy article and is for some testing purpose only and not to be fiddled with'); 

PHP Tutorials

Welcome ! to this PHP Tutorials page. I’m not a great PHP code buster, but still I feel that the tricks that I have learnt, found, should be shared with others as well.

Basics

This entry is part 2 of 41 in the series Guitar

An acoustic guitar has 6 strings, hence the “6 string” 🙂
It starts from the E string (this is the string with the lowest pitch, or lowest frequency note), then the A string, followed by the D, G, B strings. And the last one is the e string. This one is the string with the highest pitch. This e sting produces the “E” note of the next octave begining from the base E string.

We’ll denote it as.., This is the plan view (top view) of the guitar, facing the strings.

e +---------------+
B +---------------+
G +---------------+
D +---------------+
A +---------------+
E +---------------+

Now hold the guitar as you generally hold it, the body of it on the lap, and your base of your right hand (considering your are right-handed) on the bridge. Bridge is the point from where the guitar strings start, it is NOT the end where you tune the string with the knobs.

Hold your thumb and index finger as you hold a pen, withing that grip hold the plectrum (pick). The blade of the pick should be at an angle to the strings, and not directly flat to the strings.

Now practice picking the strings, begining from the base E string to the high e string. All the picking should be down strokes. Go in an easy manner, till you get a feel of distances between the strings, etc…

Once you are comfortable with the simple picking start picking alternate strings. i.e. pick E, D, then A, G, then D, B, and G, e. and then back up again. This will help you in getting a hold of picking alternate, different strings.

I’ll explain you a notation that you will follow all over, It is not my notation, probably you must have seen it somewhere.
When I say you play C note, I’ll specify a fret. A fret is marking on which you play a note, to play a note you press your finger just before the nth fret (the fret that is mentioned to produce the note).
So…

e +---------------+
B +---------------+
G +---------------+
D +----0----------+
A +--3------------+
E +---------------+

..means play the 3rd fret on the A string to produce the C note, then the play open D string (i.e do not fret the string anywhere) to play the D note.

Guitar Tutorial

This entry is part 1 of 41 in the series Guitar

This is my guitar class diary, you may consider it to be as your tutorial, guide or whatever, my purpose to publish this one is to keep the contents of my guitar class on the web.
thats it.

I start from my first class where I knew only 1 thing about guitar and that is “6 string” guitar or something… 🙂 quite an information to begin with.

Lets start now…

FIFA 2001 Tips and Tricks

Get some great tips to play FIFA 2001

The Formation

The Fifa 2001 defence is a strong one and normally doesn’t let you inside the area, To tackle that proper formation is required. The image shown along side is the formation of 4-4-2 with the flanks move up and down the pitch. This strategy is found the most suitable if you want to give a cross from wide. The flanks move up and down pretty neatly. To move them ahead, the forwards should wait for a second allow the flanks to come up and then give a through pass to them. The through pass is very necessary as it allows the player to make space for himself.

The Strategy
The strategy will develop your game plan how you want to move ahead and defend. This is very much complementry to the formation. The possesion style will help to keep the possesion of the ball while attacking, This is the most vulnerable time when you lose the possesion. While defensive mode, the pressure style is useful as it will help to move the ball up the field. The possesion style should not be kept while defending as it will lead to the ball being in your half and a possibility of losing possesion in your half which is dangerous.

While defending the offside trap should be kept by pressing ALT once. This will help to move all the defenders towards the half line and not letting the forwards of the other team to creep through. But this offside trap should be kept only if you are capable of breaking a run from the opposite forward and if you know your team’s defensive capabilities.

Camera
The normal TELE camera in the FIFA 2001 game is too very close to judge the other player’s postion. Hence the settings shown in the figure should optimize the game play as you are aware of the positions of your teammates.

Free kicks
Taking free kicks is quite difficult in this game, but once you get hold of it, bingo!! you can certainly master those.
If the free kick obtained is close to the D line then only one should attempt to curl the ball straight into the net. Or else he should try the ball passing to the players in the D. If the free kick that is obtained to the left of the net as in the image, then try to curl the ball to the left, as there is more space for the ball to go and greater probability of hitting the target. Well if you are a master you can certainly try to curl the ball through the left to right direction as chances are you’ll miss the target. Now for the directioning of the curve. Curl the ball as most as possible as it should move away from the keeper. Now by moving the direction keys take the center of the arrow just after the second defender (See the adjoining image). Be careful in doing that as if you move the ball away too much, Then the ball would definitely hit the wall. Then move the curve little downwards from the original height. This shall help to keep the ball down if extra force is applied. After that it is time to power your shot,The power should be the maximum as ball will travel at a greater speed. But be careful that the power indicator should be green only, If dark red appears the ball will definitely go away from the goal. Relax before hitting, Think and Shoot.

Movement on the pitch
The movement on the pitch should be definate and steady, Dont just try to pass directly to the forwards, try to move the ball to the flanks and then try getting the ball in from a cross. I have noticed that if a cross is given just around the D corner, and if the forward is made to hit a bicycle kick or a volley the chances are that ball will end up in the back of net are very high.

Defending
Defending is something that you need to learn as to prevent the opposite team from scoring. While in the D never ever try to tackle by sliding, If the tackle is from behind you are definitely going to defend a penalty. The best way to defend is to stand and tackle. If outside the D, A sliding tackle will do but be sure that it is not from behind.

Tips to play FIFA 99

FIFA 99 Tips and Tricks

My Personal Tricks

Always use the Stepover Nutmeg move (ALT + E), This will almost ensure you getting past the defender or the opponent.

For the corner try to curl the ball in with maximum force. And try kicking it into the net, most of the time you should find your striker grabbing the ball and putting it in the backside of the netting.

If you are trying to give a cross for a header, try giving it just from the outside of the corner of the D, The header should be succesful if the striker is good at it.

There is no shortcut to hardwork, PRACTICE, PRACTICE, …

These tips were published by EA Sports themselves

For the novice player, make sure that you keep the game speed at normal and the difficulty setting at Amateur. It is a lot easier to learn how to use the various special moves and general gameplay with these settings.

Be aware of different pressure zones on the field. If you want to build up slowly you’ll have plenty of room in your own third. You’ll have to utilise your midfield to support the forwards as opposing defenders tightly mark them.

Players who hold onto the ball tend to get closed down faster than those that pass the ball.

Don’t try and madly smash buttons, as this tends to trigger events you don’t want. Being cool and deliberate always yields the best results.

One time passes are good for moving the ball up the field quickly, and do not allow the opposition to have enough time to setup tackles.

Make use of through passes to strikers/midfielders in order to create breakaway situations. The through pass is one of the most effective ways to get into a breakaway situation.

When moving the ball up field using one of your forward players, try passing back to one of your midfielders in order to give your forwards some extra space. This will allow you to relieve some defending pressure on your forwards.

When the opposing team is on a breakaway, the new goalie charge feature is an effective method of stopping the attack. Trigger it while the goalie is still off screen to gain the element of surprise.

Be aware of star players on the opposing team, they are likely to be the ones to do damage.

Try probing the wings and the centre channel to see where the areas of least resistance are.

If the opponent does make it close to your box you are best off to use standing tackles as these are less likely to give away dangerous free-kicks or penalties.

Do not try to run the ball too close to the goal keeper. The goal keeper in FIFA ’99 can read your intentions and rush you if you get too close.

When on a breakaway situation, try using the hurdle move to evade the diving goal keeper.
Use the skill moves to anticipate and avoid impending tackles. Certain skill moves are more effective at avoiding certain types of tackles (see below).

Try using various tackles to counteract special moves. For example, someone performing a Hurdle move can be countered with the Conservative Tackle.

In Multi-player, try sticking with one player instead of trying to constantly switch to different players. The computer will give you possession of the ball if it is passed off to one of your teammate whether you are in control of that player or not. Also, it is best to switch players when possession of the ball changes hands.

You should try and get a shot away without trying to beat every defender. The goalie can’t hold everything and rebounds are often the easiest source of goals.

It’s easier to score if you use the goalie’s momentum against him. Take a look at the keeper’s position and the direction he’s moving in. Try and target your shots to the side that the keeper is moving away from.

If you are close to goal and there are no pass targets you can tap the X button to side foot one into the corner of the net.

If you are close to goal and there are no pass targets you can tap the Square button to attempt a chip shot.

Players can recover from fatigue at half time. You should check your fatigue levels so tired defenders don’t get burned.

In PROFESSIONAL MODE, turn the aggression all the way up if you like the CPU team mates to do slide tackles more often.

If you see an injury be sure to substitute as soon as possible. It is often advantageous to kick the ball off yourself so the sub can take place.

Look for visual indicators – Often in closer cameras your team mates are off screen. Check the direction of the off screen indicator as this is a signal one of your players is available to pass to.

Your CPU opponent will try several strategies to crack your defence so you should adapt your formation and strategy accordingly using the IGM Strategy feature.

If someone is right on your heels you’re better off to pass the ball in the direction you’re facing than try to pass to someone in another direction.

Tips to play FIFA 2001

ऋतुराज का Home Page