Blog Archives

Displaying Random records from MySQL database table

Sometimes we may need to display some value selected from database table which is having many records. In this situation we can select them randomly to improve user experience. It applies to displaying random advertisements, testimonials, quotes,images,background colors and news.

Posted in MySQL, Php Tagged with: ,

Displaying vertical scroll bar dynamically in HTML elements

Vertical scroll bar in HTML controls/elements/tags such as TEXTAREA and SELECT will be useful if the element has more content/items. But always showing Vertical scroll bar will be occupying some space in the page unnecessarily. So the best way is,

Posted in Html Tagged with: ,

Allowing Users to Change attribute of the HTML tag using javascript

Normally we will set values for attributes of HTML tag during design time. But each user will be expecting different values. For example “scrollamount=’2′” set in marquee tag may not be suitable for all users. Some people will expect more

Posted in Html, Javascript Tagged with: ,

How to get last row from database table

If you want to find last row in a table in your database there is no need to loop through to get the last record .Mysql provides you with a provision for that . It is easy to find last

Posted in MySQL Tagged with: ,

PHP code for preventing session hijacking

Session security is a sophisticated topic, and it’s no surprise that sessions are a frequent target of attack. Most session attacks involve impersonation, where the attacker attempts to gain access to another user’s session by posing as that user. The

Posted in Php Tagged with: ,

Resolving delimiter issue in PHP

A delimiter can be any non-alphanumeric, non-backslash, non-whitespace character. Often used delimiters are forward slashes (/), hash signs (#) and tildes (~). The following are all examples of valid delimited patterns. /foo bar/ #^[^0-9]$# +php+ %[a-zA-Z0-9_-]% Server side coding can

Posted in Php

Getting current Page Name in PHP

If you want to get the current page name , php provides you with an inbuilt function $_SERVER[‘PHP_SELF’]. $_SERVER[‘PHP_SELF’] can be used to obtain the current name in the php.It will be necessary for us to use this $_SERVER[‘PHP_SELF’] for

Posted in Php Tagged with: ,

Basics of Session and Cookies

We know that Webpages are getting displayed using stateless Protocol. So there should be someway for keeping the session of the user navigating the webpages within a website. Session variables and Cookie variables can be used for this purpose. Basically Session variables

Posted in Basics of Internet, Html, Php Tagged with: ,

MySQL – Resolved null issue in query.

We have faced strange issue with MySql old version (version 4). Our php file will pass a querystring variable “id”. It can have a value or it can be empty in some situation. Initially, we used below code, $id=$_GET[‘id’]; $sql=”select

Posted in MySQL Tagged with: ,

Dynamically changing/displaying web page content using javascript without refreshing the page

Sometimes we may need to change the content displayed in the webpage frequently. Javascript will enable achieving this without the need for refreshing the webpage.(i-e without requesting the page again). Below steps are needed for doing this. – All the

Posted in Javascript, jQuery Tagged with: ,