PHP scripts and programs for Beginner to Master

php programs, php ready to use scripts & functions, css tutorials, html, javascripts, ajax examples for Beginner to Master

Hi,

Today i will be showing you how to create a simple 1 level vertical navigation menu with the help of css.
It is very easy and same like the 1 level horizontal navigation menu.

So lets start,

For this we will be using one image


first we will create a simple code to display "unordered list" with ul and li 





So now our display of the ul will be like this



Now we will apply our css to this ul



After applying this css our menu will look like this



Full code of the vertical menu with css is as, just copy and paste it, and modify links and its over.



Hi friends,

here is a simple example of 1 level horizontal navigation menu.
for this i am using 2 images - one is orange and another is blue

you can copy these images from here 


For creating a "1 level horizontal navigation menu" we are going to use "unordered list"




Now this will create an unordered list.





Now we will apply a CSS to this unordered list to make it a horizontal navigation menu.




Hey ! Its ready ! See it !





Completed ready use script and code is here

We always require some kind of login box for any system which has members.

Here i will be showing a simple example with the help of CSS and HTML to create a attractive login box.

To begin with We will create a login box first and then apply the CSS to it

Replace "youfilename.php" with your script which has the logic to check the login.





When you will add this code to your login file then display will be like this - fully stretched on the page with a simple look.

Now we will add a css to this login box to make it look nice.





Now after applying this css see at our login box.



Now combining all together we have created a very simple nice looking login box without using any other images.
Full source code is given below. Just copy and paste it in your project, if necessary just modify the css.




Hi,
Here you will find lots of useful and ready to use free php scripts and codes in php, css, ajax, javascript and many more.....
keep visiting this blog.

Whenever you are working on a project you might need to create a database connection and select a database.

Here i am going to show you a simple way to create your connection file "connect.php"
First create a file and save it as "connect.php"






Now save this file.
Now just include this file on top of your any other php script.
No need to write code each time.
ex. create a new file called "data.php" and include "connect.php" in that file on top as



Have nice time.

How to get IP in php ?

While working on a project you might need a dynamic select box to be generated from the values present in the database.
So this example gives you a simple way to populate a select box with the values present in the database.

Consider a example - there is a table "article" in your database "mydb"

So for this first we need to create a connection with the database and we need to select the database.

For this we will create a file called "connect.php"

replace the values with your actual values as per directed in code



After that we will write our main code in a file called "myselect.php"



And its over. Its very simple.
Try it out, if you face any problem then comment here, i will help you.

Show a-z links on a page for pagination




You can replace $PHP_SELF with the filename for which you want to generate this pagination.
Ofcourse this code doesnt shows the logic to display actually pagination, but instead of taking characters from a-z in a array this is the simple way to show a-z characters for processing.

Soon even i will publish the code to do actual pagination.

[Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in]


Hi,
when you are doing programming in php you might be getting a error like

[Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in] 

this in your php script.

Most of the times if there is mistake in spelling then many errors occurs.

Just check out following things if you encounter this kind of Warning in your php program

  1. First check your query.
  2. If you are using different connection file for creating connection then check whether it is included in your script or not.
  3. If query is correct then check your Database Connection.