difference between urlencode and urldecode in php
difference between urlencode and urldecode in php
urlencode()
it returns the URL encoded version of the given string. URL coding converts special characters into % signs followed by two hex digits. For example: urlencode(”10.00%”) will return “10%2E00%25″.
URL encoded strings are safe to be used as part of URLs.
urldecode()
it returns the URL decoded version of the given string.Anwser 2:
string urlencode(str) – Returns the URL encoded version of the input string. String values to be used in URL query string need to be URL encoded. In the URL encoded version:
Alphanumeric characters are maintained as is.
Space characters are converted to “+” characters.
Other non-alphanumeric characters are converted “%” followed by two hex digits representing the converted character.
string urldecode(str) – Returns the original string of the input URL encoded string.For example:
$discount =”20.00%”;
$url = “http://domains.com/submits.php?discs=”.urlencode($discount);
echo $url;You will get “http://domains.com/submits.php?discs=20%2E00%25″
urlencode()
it returns the URL encoded version of the given string. URL coding converts special characters into % signs followed by two hex digits. For example: urlencode(”10.00%”) will return “10%2E00%25″.
URL encoded strings are safe to be used as part of URLs.
urldecode()
it returns the URL decoded version of the given string.Anwser 2:
string urlencode(str) – Returns the URL encoded version of the input string. String values to be used in URL query string need to be URL encoded. In the URL encoded version:
Alphanumeric characters are maintained as is.
Space characters are converted to “+” characters.
Other non-alphanumeric characters are converted “%” followed by two hex digits representing the converted character.
string urldecode(str) – Returns the original string of the input URL encoded string.For example:
$discount =”20.00%”;
$url = “http://domains.com/submits.php?discs=”.urlencode($discount);
echo $url;You will get “http://domains.com/submits.php?discs=20%2E00%25″
major difference between include and require in php
major difference between include and require in php
In both are same functionality but main difference in error handling.
include() function produces a Warning message on failure,
while require() results in a Fatal Error.
In both are same functionality but main difference in error handling.
include() function produces a Warning message on failure,
while require() results in a Fatal Error.
major difference between get and post in php
major difference between get and post in php
In post method value not shown in url,but get method value shown in url,other main difference is value storing capacity,in get method value and variable are limited,but post method this are unlimited,
get method hidden variables are shown as a part of the URL.but post hidden variable are always hidden.
In post method value not shown in url,but get method value shown in url,other main difference is value storing capacity,in get method value and variable are limited,but post method this are unlimited,
get method hidden variables are shown as a part of the URL.but post hidden variable are always hidden.
list of sorting functions in php
list of sorting functions in php
asort()
arsort()
ksort()
krsort()
uksort()
sort()
natsort()
rsort()
asort()
arsort()
ksort()
krsort()
uksort()
sort()
natsort()
rsort()
list of tables in mysql
list of tables in mysql
Total 5 types of tables we can create
1. MyISAM
2. Heap
3. Merge
4. INNO DB
5. ISAM
MyISAM is the default storage engine as of MySQL 3.23. When you fire the above create query MySQL will create a MyISAM table.
Total 5 types of tables we can create
1. MyISAM
2. Heap
3. Merge
4. INNO DB
5. ISAM
MyISAM is the default storage engine as of MySQL 3.23. When you fire the above create query MySQL will create a MyISAM table.
simple programs in php
simple programs in php
ex1:print a word
<?php
echo "test";
?>
ex2:add two numbers
<?php
$a=50;
$b=100;
echo $c=$a+b;
?>
ex3: print date
$to = "test@example.com";
$subject = "simple email";
$message = "Hello! This is a simple email message.";
$from = "test1@example.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>
ex5:using switch function
<?php
switch ($x)
{
case 1:
echo "Number 1";
break;
case 2:
echo "Number 2";
break;
case 3:
echo "Number 3";
break;
default:
echo "No number between 1 and 3";
}
?>
simple file uploading program
ex1:print a word
<?php
echo "test";
?>
ex2:add two numbers
<?php
$a=50;
$b=100;
echo $c=$a+b;
?>
ex3: print date
<?PHP $date = Date("l - F d, Y"); print("Hello World<BR />\n"); print("Today's date is: $date\n"); ?>
ex4:simple email program<?php
$to = "test@example.com";
$subject = "simple email";
$message = "Hello! This is a simple email message.";
$from = "test1@example.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>
ex5:using switch function
<?php
switch ($x)
{
case 1:
echo "Number 1";
break;
case 2:
echo "Number 2";
break;
case 3:
echo "Number 3";
break;
default:
echo "No number between 1 and 3";
}
?>
simple file uploading program
javascript using dynamic elements in html
javascript using dynamic elements in html
sample page for creating dynamic elements in HTML using Javascript.
For working Please COPY & PASTE in an editor and run it on browser.
Please edit the Js part for modify the code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>test</title>
<meta name="GENERATOR" content="Quanta Plus">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
//Please edit the Js part for modify the code
function show_new()
{
var id=document.getElementById('count').value;
var currentVal = document.getElementById('showTr').innerHTML;
document.getElementById('showTr').innerHTML = currentVal +"<tr><td align=\"center\" width=\"33%\">"+id+"<input type=\"text\" name=\"events_venue_"+id+"\" ></td><td align=\"center\" width=\"33%\"><input type=\"text\" name=\"events_title_"+id+"\" size=\"10\"></td><td align=\"center\" width=\"33%\"><input type=\"radio\" name=\"events_date_"+id+"\">Yes <input type=\"radio\" name=\"events_date_"+id+"\">No</td></tr>";
document.getElementById('count').value = parseInt(id)+1;
}
</script>
</script>
</head>
<body>
<TR>
<TR>
<td align="center" colspan="2"> <a href="javascript:void(0);" onclick="show_new()">add more</a></td>
</TR>
<tr><TD><table id="showTr">
<tr><td align="center" width="33%"><input type="text" name="events_venue" ></TDd><td align=center
width=33%><input type='text' name="events_title" size="10"></td><td align="center" width="33%"><input type="radio" name="events_date">Yes <input type="radio" name="events_date">No</td></tr>
</table>
</TD>
</tr>
<TR>
<td align="center" colspan="2"><input type="hidden" name="count" id="count" value="2"></td>
</TR>
</table>
</body>
</html>
sample page for creating dynamic elements in HTML using Javascript.
For working Please COPY & PASTE in an editor and run it on browser.
Please edit the Js part for modify the code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>test</title>
<meta name="GENERATOR" content="Quanta Plus">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
//Please edit the Js part for modify the code
function show_new()
{
var id=document.getElementById('count').value;
var currentVal = document.getElementById('showTr').innerHTML;
document.getElementById('showTr').innerHTML = currentVal +"<tr><td align=\"center\" width=\"33%\">"+id+"<input type=\"text\" name=\"events_venue_"+id+"\" ></td><td align=\"center\" width=\"33%\"><input type=\"text\" name=\"events_title_"+id+"\" size=\"10\"></td><td align=\"center\" width=\"33%\"><input type=\"radio\" name=\"events_date_"+id+"\">Yes <input type=\"radio\" name=\"events_date_"+id+"\">No</td></tr>";
document.getElementById('count').value = parseInt(id)+1;
}
</script>
</script>
</head>
<body>
<TR>
<TR>
<td align="center" colspan="2"> <a href="javascript:void(0);" onclick="show_new()">add more</a></td>
</TR>
<tr><TD><table id="showTr">
<tr><td align="center" width="33%"><input type="text" name="events_venue" ></TDd><td align=center
width=33%><input type='text' name="events_title" size="10"></td><td align="center" width="33%"><input type="radio" name="events_date">Yes <input type="radio" name="events_date">No</td></tr>
</table>
</TD>
</tr>
<TR>
<td align="center" colspan="2"><input type="hidden" name="count" id="count" value="2"></td>
</TR>
</table>
</body>
</html>
initialize the variable in php
initialize the variable in php
Actually, Its not mandatory in php. But its recommended to
initialize variable before its usage. In most of the servers the the
error reporting for display notices are disabled. In the case of
servers which enabled error reporting on for notices, its highly
recommended to initialize variable before its usage.
Actually, Its not mandatory in php. But its recommended to
initialize variable before its usage. In most of the servers the the
error reporting for display notices are disabled. In the case of
servers which enabled error reporting on for notices, its highly
recommended to initialize variable before its usage.
subquery in mysql
subquery in mysql
A query that is used within another query. For example a select-statement within the WHERE or HAVING clause of another SQL statement. Mysql supporting the subquery system.
A query that is used within another query. For example a select-statement within the WHERE or HAVING clause of another SQL statement. Mysql supporting the subquery system.
difference between where and having
difference between where and having
WHERE is a single row function, where as Having is based on groups.
When we use having Having we should use the Group by keyword.
WHERE is a single row function, where as Having is based on groups.
When we use having Having we should use the Group by keyword.
meaning of view in sql
meaning of view in sql
View is a representation of a sql statement stored in memory, which can be easily reusable.
we can view the data without storing the data into the object. We can restict the view of a table i.e. can hide some of columns in the tables. We can Join two or more tables and show it as one object to user.
View is a representation of a sql statement stored in memory, which can be easily reusable.
we can view the data without storing the data into the object. We can restict the view of a table i.e. can hide some of columns in the tables. We can Join two or more tables and show it as one object to user.
difference in inner join and outer join in mysql
difference in inner join and outer join in mysql
The INNER JOIN takes data from both tables returns the
specified data exists in both tables. But the OUTER JOIN check both
tables and returns values from the outer table when the criteria mets.
Other major join are LEFT OUTER JOIN, RIGHT OUTER JOIN.
The INNER JOIN takes data from both tables returns the
specified data exists in both tables. But the OUTER JOIN check both
tables and returns values from the outer table when the criteria mets.
Other major join are LEFT OUTER JOIN, RIGHT OUTER JOIN.
difference in html and xml
difference in html and xml
HTML is used for presentation. While the XML is used for
holding the data.
HTML has predefined tags. XML has no predefined tags.
We can use our own tags in XML. It is self descriptive language.
HTML is not case sensitive, while XML is.
In HTML the close tags are not mandatory, But in XML
its must one
HTML is used for presentation. While the XML is used for
holding the data.
HTML has predefined tags. XML has no predefined tags.
We can use our own tags in XML. It is self descriptive language.
HTML is not case sensitive, while XML is.
In HTML the close tags are not mandatory, But in XML
its must one
meaning of http
meaning of http
HTTP is HyperText Transfer Protocol. It is a protocol
used to transfer hypertext requests and information between servers
and browsers.
There are two types of http requests. They are GET method and POST method.
HTTP is HyperText Transfer Protocol. It is a protocol
used to transfer hypertext requests and information between servers
and browsers.
There are two types of http requests. They are GET method and POST method.
differences between php4 and php5
differences between php 4 and php5
PHP5 has more advanced class architecture than PHP4. Its has method
access properties like protected, public, private. The constructor,
destructor methods are changed in php5. Ie writing a constructor
function has been changed also there is no destructor in php4 version.
In PHP 5 version, there is , more advanced function added.
Exception were introduced in the PHP5 version.
In PHP5 new extensions like simpleXML, DOM were introduced.
PHP5 has more advanced class architecture than PHP4. Its has method
access properties like protected, public, private. The constructor,
destructor methods are changed in php5. Ie writing a constructor
function has been changed also there is no destructor in php4 version.
In PHP 5 version, there is , more advanced function added.
Exception were introduced in the PHP5 version.
In PHP5 new extensions like simpleXML, DOM were introduced.
seo freelancer in kerala
seo freelancer in kerala
contact us
DScom
mobile:09142162258
gmail:dscomtvm@gmail.com
http://dscom.000a.biz
contact us
DScom
mobile:09142162258
gmail:dscomtvm@gmail.com
http://dscom.000a.biz
php freelancer in kerala
php freelancer in kerala
DScom
arun alex
email:dscomtvm@gmail.com
phone:09142162258
http://dscom.000a.biz
DScom
arun alex
email:dscomtvm@gmail.com
phone:09142162258
http://dscom.000a.biz
differences between drop and truncate in mysql
differences between drop and truncate in mysql
DROP TABLE table_name -it will delete the table and its data.
TRUNCATE TABLE table_name -it will delete the data of the table, but not the table definition.
DROP TABLE table_name -it will delete the table and its data.
TRUNCATE TABLE table_name -it will delete the data of the table, but not the table definition.
difference between strstr and stristr in php
difference between strstr and stristr in php
strstr() returns part of a given string from the first occurrence of a given substring to the end of the string. For example: strstr("user@example.com","@") will return "@example.com".
stristr() is idential to strstr() except that it is case insensitive.
strstr() returns part of a given string from the first occurrence of a given substring to the end of the string. For example: strstr("user@example.com","@") will return "@example.com".
stristr() is idential to strstr() except that it is case insensitive.
main difference between HTML and XML
main difference between HTML and XML
HTML is used for presentation. While the XML is used for
holding the data.
HTML has predefined tags. XML has no predefined tags.
We can use our own tags in XML. It is self descriptive language.
HTML is not case sensitive, while XML is.
In HTML the close tags are not mandatory, But in XML
its must one
HTML is used for presentation. While the XML is used for
holding the data.
HTML has predefined tags. XML has no predefined tags.
We can use our own tags in XML. It is self descriptive language.
HTML is not case sensitive, while XML is.
In HTML the close tags are not mandatory, But in XML
its must one
difference between $a == $b and $a === $b
difference between $a = = $b and $a = = = $b
Checks whether $a = = $b equals, but the $a = = = $b is not only
checks equal, but also check its type.
Checks whether $a = = $b equals, but the $a = = = $b is not only
checks equal, but also check its type.
common types of errors in php
common types of errors in php
php affected lot of errors,here common type of errors are below
1. Notices:
non-critical errors,not displayed to window, for example: variable is not def ind,do not affect the program.
2. Warnings:
serious errors -it displayed to window for example: include() a file which does not found, at the time these errors displayed, but they do not affect the script.
3. Fatal errors:
These are critical errors, affect termination of the script, - for example, instantiating an object of a non-existent class, or calling a non-existent function.
php affected lot of errors,here common type of errors are below
1. Notices:
non-critical errors,not displayed to window, for example: variable is not def ind,do not affect the program.
2. Warnings:
serious errors -it displayed to window for example: include() a file which does not found, at the time these errors displayed, but they do not affect the script.
3. Fatal errors:
These are critical errors, affect termination of the script, - for example, instantiating an object of a non-existent class, or calling a non-existent function.
difference between $message and $$message in php
difference between $message and $$message in php
$message is variable,$$message referece variable.
example
$message is variable,$$message referece variable.
example
$message = "test"; $test= "test11"; echo $message; // it will be Output: test echo $$message; // it will be Output: test11
short_open_tag in php
Suppose your Zend engine supports the mode <? ?> Then how can u
configure your PHP Zend engine to support <?PHP ?> mode ?
at the time php.ini file:
set
short_open_tag=on
to make PHP support
configure your PHP Zend engine to support <?PHP ?> mode ?
at the time php.ini file:
set
short_open_tag=on
to make PHP support
preg_match example
preg_match example
preg_match(“/^http:\/\/.+@(.+)$/”,’http://info@abc.com’,$found);
echo $found[1];
it will return :abc.com
preg_match(“/^http:\/\/.+@(.+)$/”,’http://info@abc.com’,$found);
echo $found[1];
it will return :abc.com
how many ways retrieve data in mysql using php
it can get 4 ways.
1. mysql_fetch_row.
2. mysql_fetch_array
3. mysql_fetch_object
4. mysql_fetch_assoc
1. mysql_fetch_row.
2. mysql_fetch_array
3. mysql_fetch_object
4. mysql_fetch_assoc
submit a form without a submit button
submit a form without a submit button
Java script submit() function in order to submit the form without explicitly clicking any submit button.
You can attach the document.formname.submit() method to onclick,onchange events of different inputs and perform the form submission.
Java script submit() function in order to submit the form without explicitly clicking any submit button.
You can attach the document.formname.submit() method to onclick,onchange events of different inputs and perform the form submission.
__sleep and __wakeup in php
__sleep and __wakeup in php
__sleep returns the array of all the variables than need to be saved, while __wakeup retrieves them
__sleep returns the array of all the variables than need to be saved, while __wakeup retrieves them
difference between accessing a class method via -> and via ::?
difference between accessing a class method via -> and via ::?
:: is access methods that can perform static operations, i.e. those, which do not require object initialization.
:: is access methods that can perform static operations, i.e. those, which do not require object initialization.
what is die() in php
die() function used in php for prints a message and exits the current script.it same as exit() function.
example
<?php
$con = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$con) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($con);
?>
example
<?php
$con = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$con) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($con);
?>
make directory in php with function
make directory in php with function
mkdir() function used to creates a directory in php,it returns true on success, or therwise on failure.
syntax
mkdir(path,mode,recursive,context);
<?php
mkdir("testing");
?>
mkdir() function used to creates a directory in php,it returns true on success, or therwise on failure.
syntax
mkdir(path,mode,recursive,context);
<?php
mkdir("testing");
?>
how can check file size in php
filesize() function used returns the size of the specified file.it returns the file size in bytes on success or FALSE on failure.
<?php
echo filesize("dule.txt");
?>
it will be 20
<?php
echo filesize("dule.txt");
?>
it will be 20
getcwd fucnction in php
it returns current directory.it returns current directory on success and otherwise failure.
syntanx
getcwd();
<?php
echo getcwd();
?>
it could be:
C:\test\mains
syntanx
getcwd();
<?php
echo getcwd();
?>
it could be:
C:\test\mains
change directory in php with function
change directory in php with function
chdir() function is used to change directory in php,it returns true on success and otherwise false.
<?php
//Get current directory
echo getcwd();
echo "<br />";
//Change to the images directory
chdir("test1");
echo "<br />";
echo getcwd();
?>
if current directory is C:\test
it will be result
C:\test\test1
chdir() function is used to change directory in php,it returns true on success and otherwise false.
<?php
//Get current directory
echo getcwd();
echo "<br />";
//Change to the images directory
chdir("test1");
echo "<br />";
echo getcwd();
?>
if current directory is C:\test
it will be result
C:\test\test1
difference between copy and move in php
Copy : copy() function used copy a file in php,this function returns true on success and else failure.
syntax is
copy(source,destination)
Move :It means moved file in given destination, If the file is valid, it was uploaded through the php HTTP POST upload mechanism, it will be moved to the filename given by destination.Otherwise no action will occur, and move_uploaded_file() will return FALSE.
syntax is
move_uploaded_file(source,destination)
syntax is
copy(source,destination)
Move :It means moved file in given destination, If the file is valid, it was uploaded through the php HTTP POST upload mechanism, it will be moved to the filename given by destination.Otherwise no action will occur, and move_uploaded_file() will return FALSE.
syntax is
move_uploaded_file(source,destination)
delete file in php with function
delete file in php with function
unlink() function used file delete in php
example
$file = "test.txt";
unlink($file);
unlink() function used file delete in php
example
$file = "test.txt";
unlink($file);
copy() function in php
copy() function in php
copy() function used copy a file in php,this function returns true on success and else failure.
syntax
copy(file,to_file)
it means first parameter file is source file and to_file is destination file
example
<?php
echo copy("test.txt","test1.txt");
?>
it will be returns 1
copy() function used copy a file in php,this function returns true on success and else failure.
syntax
copy(file,to_file)
it means first parameter file is source file and to_file is destination file
example
<?php
echo copy("test.txt","test1.txt");
?>
it will be returns 1
Subscribe to:
Posts (Atom)