You are here: Daniel Dumas »

Tag : PHP Tutorials

Fix wordpress fatal error allowed memory size exhausted

Fatal error: Allowed memory size of …… bytes exhausted (tried to allocate …. bytes) in home/of/some/thing/fishy.php :)

Wordpress Fatal Error allowed memory size exhaustedI experienced this weird WordPress or rather PHP error last night when trying to view my blog when i got home, at first i thought that there was a technical problem at my server so i waited, then i waited and waited and waited again for almost 7 hours then i cant wait no more i want to blogggg… so i contact my hosting provider and they told me that there is nothing wrong with the server nahhh WTF! i told to my self. . :) Keep Reading…

PHP and MySQL Basics: Assigning and Using Variables

Assigning a value to PHP variable is very easy, you can use the assignment operator ( = ) to store values into a php variable. refer below for example.

<html>
<head>
<title>Assigning Values to PHP Variable</title>
</head>
<body>
<?php
//this is how you assign a value to a php variable
$age = 20;
//To use the variable $age, simply call its name and PHP will substitute its value at runtime.
//this is how you use a php variable
echo "I am now $age years old";
?>
</body>
</html>

copy and paste the code above to your text editor and save it as variable.php then run it on your localhost.

you should get this output.. Keep Reading…

PHP and MySQL Basics: Variables

Variables are the building blocks of any programming language. in PHP variables are very important, it used to store numeric or non-numeric datas. PHP supports different types of variable types (Booleans, Integers, Floating point numbers, Strings, Arrays, Objects, resources and nulls.

PHP VARIABLE NAMING RULES:

  1. PHP variables starts with a $ sign : example. $daniel
  2. $ sign is followed by a letter or an underscore. thus $123 is not a valid PHP variable. Keep Reading…

PHP and MySQL Basics: Comments

For greater readability of your PHP code, you should add comments to it, so that you or other people who will look at the code later will understand it clearly.

To do this refer to the example below..

PHP Single Line Comment: Keep Reading…

PHP and MySQL Basics: Your First PHP Script

Now that you know the basic syntax of PHP, let me congratulate you, congrats! hehe. . You are now ready to learn your very first PHP script.

consider this example on embedding your first PHP script into HTML.

<html>
<head>
<title>Hello World!</title>
</head>
<body>
<!-- This is how you print output in PHP-->

<h2><?php echo "Philippines is a beautiful country!"; ?></h2>

</body>
</html>

copy and save this to your text editor with a .php extension then run it on your localhost.. Keep Reading…

PHP and MySQL Basics: Syntax

PHP syntax is very simple it has 3 main parts, the first part is the php opening tag which is <?php, after that is your PHP CODE then the last part is the php closing tag which is ?>

it looks like this..

<?php
. . . . . . . . . . . . . . . . . . . . . .
YOUR PHP CODE HERE
. . . . . . . . . . . . . . . . . . . . . .
?>

you can also use the PHP Short open tags:

<? ?>
<?= ?>

but this is considered a bad habit.. you can use this tags but be sure that short open tag is set to on in your PHP.INI file.

Keep Reading…

PHP and MySQL Basics: Software Needed

Now that you have a little background about PHP, let’s now talk about the tools/software that you need in this lesson.

WHAT DO YOU NEED…

  1. A Web Server - Apache / IIS will work too..
  2. PHP - so that our web server can understand our php file.
  3. Database - MySQL
  4. Text Editor - Notepad, Dreamweaver, PHP Designer or any text editor that you want..
  5. Web Browser - you can use any broswer of your choice(Firefox, IE, SAFARI, OPERA, Chrome)..
  6. Operating System - Linux, Windows or Mac OS.

Keep Reading…

PHP and MySQL Basics: Introduction

Hello this is the first part of the PHP and MySQL basic tutorial here in my blog. if you have any questions or other concerns feel free to leave a comment or contact me through my contact page. okey before we go deep in learning the PHP langauge. lets first define what php is..

Keep Reading…

PHP and MySQL Basics Tutorial

PHP Basics

Hello guys today i am going to start my basic PHP tutorial. i will give examples in every part of this tutorial so that you can follow with me easily. my aim in this tutorial is to share my knowledge in PHP to anyone specially to my blog readers who wants to learn the basics of PHP. i will focus on the very basic of PHP so that anyone can follow along even if you dont have any background in PHP or any other programming language Keep Reading…