Ads Header

ssdf

sssssadf asdf asdfsad fasd dfasdf

File Upload in PHP with Example

if (($_FILES["file"]["type"] == "image/gif") ($_FILES["file"]["type"] == "image/jpeg") ($_FILES["file"]["type"] == "image/pjpeg")&& ($_FILES["file"]["size"] <> 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "
"; }

else {
echo "Upload: " . $_FILES["file"]["name"] . "
";

echo "Type: " . $_FILES["file"]["type"] . "
";

echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb
";

echo "Temp file: " . $_FILES["file"]["tmp_name"] . "
";

if (file_exists("upload/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. ";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"upload/" . $_FILES["file"]["name"]);
echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
}
}
}
else
{
echo "Invalid file";
}

Read more...

Mail in PHP with Example

Mail in PHP with Example

$to = someone@example.com;

$subject = "Test mail";

$message = "Hello! This is a simple email message.";

$from = someonelse@example.com;

$headers = "From: $from";

mail($to,$subject,$message,$headers);

echo "Mail Sent.";

Read more...

Sesssion in PHP with example

session_start();
if(isset($_SESSION['views']))
$_SESSION['views']=$_SESSION['views']+1;
else $_SESSION['views']=1;

echo "Views=". $_SESSION['views'];
Read more...

Retrieve data from Cookie in PHP

// Print a cookie
echo $_COOKIE["user"];
// A way to view all cookies
print_r($_COOKIE);
Read more...

Set Cookie with PHP

setcookie("user", "Alex Porter", time()+3600);
Read more...

Select Data From a Database Table with PHP Mysql

$con = mysql_connect("localhost","peter","abc123");
if (!$con)
{ die('Could not connect: ' . mysql_error());
}
mysql_select_db("my_db", $con);
$result = mysql_query("SELECT * FROM person");
while($row = mysql_fetch_array($result))
{
echo $row['FirstName'] . " " . $row['LastName'];
}

mysql_close($con);

Read more...

Php Math Functions

PHP Math Functions

abs()
Returns the absolute value of a number

acos()
Returns the arccosine of a number

acosh()
Returns the inverse hyperbolic cosine of a number

asin()
Returns the arcsine of a number

asinh()
Returns the inverse hyperbolic sine of a number

atan()
Returns the arctangent of a number as a numeric value between -PI/2 and PI/2 radians

atan2()
Returns the angle theta of an (x,y) point as a numeric value between -PI and PI radians

ceil()
Returns the value of a number rounded upwards to the nearest integer

cos()
Returns the cosine of a number

cosh()
Returns the hyperbolic cosine of a number

exp()
Returns the value of Ex

expm1()
Returns the value of Ex - 1

floor()
Returns the value of a number rounded downwards to the nearest integer

fmod()
Returns the remainder (modulo) of the division of the arguments

is_finite()
Returns true if a value is a finite number

is_infinite()
Returns true if a value is an infinite number

is_nan()
Returns true if a value is not a number

log()
Returns the natural logarithm (base E) of a number

log10()
Returns the base-10 logarithm of a number

max()
Returns the number with the highest value of two specified numbers

min()
Returns the number with the lowest value of two specified numbers
Read more...

A to Z Tutorial for PHP

Visit below link for A to Z Tutorial for PHP

http://www.php-mysql-tutorial.com/php-tutorial/
Read more...

Free Download Wamp( Php mysql apache)

Readymade Package of PHP , apche and mysql nothing to do just install and
enjoy

http://www.wampserver.com/en/download.php
Read more...

How to install PHP IIS 6?

Use below link

http://www.peterguy.com/php/install_IIS6.html#phpInstall

i already test it works fine
Read more...

How to restore the browser's scroll position after a postback Asp.net C#?

Set the SmartNavigation attribute to true.
Read more...

How to read the comma seperated values from a string asp.net C#?

string myString = "A, B, C, D";
string delimStr = " ,";
char[] delimiter = delimStr.ToCharArray();
foreach (string s in myString.Split(delimiter))
{
Response.Write (s.ToString ()+ "
");
}
Read more...

How to get list of all files in the directory asp.net c#?

DirectoryInfo dirInfo = new DirectoryInfo(Server.MapPath(""));
DataGrid1.DataSource = dirInfo.GetFiles("*.aspx");
DataGrid1.DataBind();
Read more...

How to do text encryption and decryption Asp.net?

Read more...

How to convert a string to HTML format asp.net C#?

string mystring=”Tom & Jerry”;
Response.Write (HttpUtility.HtmlDecode (mystring));
Read more...

How to specify a line break in a Label's Text Asp.net C#?

Label1.Text = "" + "
" + "";
Read more...

How to get the IP address of the host accessing my site Asp.net C#?

Response.Write (Request.UserHostAddress.ToString ());
Read more...

How to format a Telphone number in the xxx-xxx-xxxx format Asp.net C#?

double Telno= double.Parse(ds.Tables[0].Rows[0]["TelNo"].ToString());
Response.Write(Telno.ToString("###-###-####"));
Read more...

What is the difference between Server.Transfer and Server.Execute Asp.net C#?

Server.Transfer is used to End the current weform and begin executing a new webform. This method works only when navigating to a Web Forms page (.aspx)
Server.Execute is used to begin executing a new webform while still displaying the current web form. The contents of both forms are combined. This method works only when navigating to a webform page(.aspx)
Read more...

How to change the Page Title dynamically Asp.net C#?

C#
//Declare
protected System.Web.UI.HtmlControls.HtmlGenericControl Title1 ;
//In Page_Load
Title1.InnerText ="Page 1" ;
Read more...

How to get the hostname or IP address of the server Asp.net C#?

You can use either of these:
HttpContext.Current.Server.MachineName
HttpContext.Current.Request.ServerVariables["LOCAL_ADDR"]
Read more...

How to convert string to a DateTime and compare it with another DateTime Asp.net C#?

bool blntimeIsOk = (DateTime.Parse("15:00") < DateTime.Parse("08:00"));
Response.Write (blntimeIsOk);
Read more...

How to validate that a string is a valid date Asp.net C#?

bool blnValid=false;
try
{
DateTime.Parse(MyString);
blnValid=true;
}
catch
{
blnValid=false;
}
Read more...

How to include multiple vb/cs files in the source Asp.net?

You can do this using assembly directives.
<%@ assembly src="test1.vb" %>
<%@ assembly src="test2.vb" %>
or
<%@ assembly src="test1.cs" %>
<%@ assembly src="test2.cs" %>
Read more...

How to convert milliseconds into time Asp.net?

TimeSpan ts = TimeSpan.FromMilliseconds(10000);
Response.Write (ts.ToString () );
Read more...

What is the difference between URL and URI?

A URL is the address of some resource on the Web, which means that normally you type the address into a browser and you get something back. There are other type of resources than Web pages, but that's the easiest conceptually. The browser goes out somewhere on the Internet and accesses something.
A URI is just a unique string that uniquely identifies something, commonly a namespace. Sometimes they look like a URL that you could type into the address bar of your Web browser, but it doesn't have to point to any physical resource on the Web. It is just a unique set of characters, that, in fact, don't even have to be unique.
URI is the more generic term, and a URL is a particular type of URI in that a URL has to uniquely identify some resource on the Web.
Read more...

What is the best way to output only time and not Date?

Response.Write(DateTime.Now.ToString("hh:mm:ss"));
Read more...

How to Convert VB.net code to C# ?

Read more...

How to Convert C# code to VB.net ?

Read more...

How to Compare time in Asp.net C#?

string t1 = DateTime.Parse("3:30 PM").ToString("t");
string t2 = DateTime.Now.ToString("t");
if (DateTime.Compare(DateTime.Parse (t1), DateTime.Parse (t2)) < 0 )
{
Response.Write(t1.ToString() + " is < than " + t2.ToString());
}
else
{
Response.Write(t1.ToString() + " is > than " + t2.ToString());
}
Read more...

ssss

sssssadf asdf asdfsad fasdf asdfasdf