Gain Your PHP Knowledge!


#1

Dear 000webhost users,

It’s really nice to have a great community at the 000webhost forum who are really interested in web development. I have some great news for you, dear PHP developers!

Recently I wrote some articles to my own website developer.hyvor.com. Always I enjoy writing articles because a lot of users worldwide read those and learn. I feel really good when I see their feedbacks.

These are the tutorials that might help you to gain your knowledge.

  • Image Upload with AJAX, PHP, and MYSQL - The Beginner’s Guide TRENDING
    In this tutorial, we will talk about how to upload an image to the server with AJAX, validate it with PHP, save it in the server, and finally, we will save the path of the image in the database to retrieve the image later.

  • The Best Way to Perform MYSQLI Prepared Statements in PHP
    The best way of doing prepared statement is pretty simple than the other non-best ways. So, why wouldn’t you try this method? This method fastens your programming while securing your website

  • Live Search with AJAX, PHP, and MYSQL
    This tutorial shows you how to create a live search with AJAX, PHP and MYSQL step-by-step

  • Input Validation With PHP
    Every PHP developer must consider about web security. So, validating user Inputs is a must. This tutorial will teach you how to validate, sanitize inputs. Also, You will learn how to prevent XSS attacks.

  • Autoloading Classes/Namespaces
    There’s no way to be a good PHP programmer without learning Object Oriented Programming. Even you know OOP, what if you don’t know about autoloading? It’s like you have a car without an engine. This tutorial will master your knowledge on autoloading classes and namespaces.

If you are interested in AJAX technologies you have two articles to read.

  • Ajax Request Handler With PHP
    This tutorial will teach you everything about how to create an ajax request handler with PHP. I have explained how to handle errors, get user inputs, etc. I’m sure this tutorial will make you an AJAX hero.

  • Ajax Long Polling with PHP
    A website that has a real-time notification system is awesome! Why don’t you create your own real-time notification system? It’s pretty easier than you think. Check out this tutorial. It will teach you how to implement a Long Polling system in your website with PHP.

More PHP Tricks

  • Use .Htaccess Auto Prepending Effectively
    One of nice uses of .htaccess is auto prepending. By using auto prepending, we can execute a PHP file before executing the requested file without using any code. There are some great points to use auto prepending to make programming super easy

If you have any question to ask, reply here or comment on my website’s article.

Happy Web Mastering!

Supun,
Moderator at 000webhost.


#2

i want to change my website to ajax site using ajax to load pages. will it effect my website in a good or a bad way and thanks
**this is my website url **
https://gamehup.com/browser-games/index


#3

So you wana load pages without page refresh?


#4

yep thats exacly what i want


#5

@AwadGorg

You need your site to be like this forum right?

So, you have to create some ajax handlers. First you must go through the 3rd Tutorial I have mentioned above. You will learn how to create a handler there.

There are two ways to load pages,

  • You can get JSON data from the server using ajax and convert it to HTML with DOM (which is more efficient and hard)
  • You can get HTML content from the file and display it in your main page.

I can see the red bordered part of following image is there on your every page. So, you don’t need to get that HTML over and over again with Ajax.

I’ll explain how to do that, but you can change any step according to your needs

  • First, wrap the dynamic content with a div and add a id to make it easy to select with javascript. (I have used wrapper as the id)
  • Then, add the dynamic content into separated files in the server. (You don’t need scripts and css files. Just the div tags and other)
    Only following parts in your code

  • Then send an AJAX request to that file. So, response will be that HTML code.

  • Modify the onreadystatechange function.

    http.onreadystatechange = function() {
      if (this.readyState == 4 && this.status == 200) {
           
           var html = this.responseText;
           var wrap = document.getElementById('wrapper');
    
           wrap.innerHTML = html;
    
       }
    }
    

Additionally, you can add loaders and more with AJAX request. :smile:

If you have any question to ask, feel free and ask :wink:


#6

Additionally, this technology is called Single Page Application. So that you can search internet on that keyword and find more information. :wink:


#7

am looking at Creating an AJAX Website using HTML5 History API.
and yes am using the header, footer, and the CSS file in almost all of my pages I don’t want to get that HTML over and over again even the ads i dont want it load over and over. by using ajax it will save me a lot of HTTP requests.


#8

and do you think i should drop this website and make a new one or this one is good enough. and thanks for help


#9

Nope. Don’t delete it.

  • Create a new file ( This will be the main page)
  • Include header and footer in it
  • Create other files without header and footer
  • Load them with AJAX using the above example I have shown. Show it in a content box (wrapper in the above example)

#10

my JavaScript is sucks when it comes to front end am more into jquery much easier. and OOP no big problem am learning it right now and it will be good for me to implement it to my site but javascript i know only the very basics of it


#11

You should have a good knowledge on javascript to do this, as it’s hard to manage multiple pages in client side.


#12

can i do that with jquery


#13

Sure you can do it with jQuery


#14

as someone who want to gain more knowledge in backend, i have a good knowledge in PHP MYSQL PDO and learning OOP,and ajax what should i learn next


#15

Well, You Could Learn some ruby on rails and some python :wink:


#16

what python have to do with web development


#17

https://worthwhile.com/blog/2016/07/19/django-python-advantages/


#18

thanks that’s was really helpful I set my mind into python but which is better to learn PHP with larval or python with Django


#19

They say python is easier to understand as it comes quite more english-ish.


#20

I have learnt both php (lot) and python (a little).

By my experience, PHP is completely focused for web developement. Ruby on rails is also like PHP.

But, python is a different language. As @ckhawand said, it is easy to learn and code.

I would recommend you to learn both and choose the best.