How to select the largest value in MySQL?
To return the largest value from a column, MAX() function is used.
Here is the syntax:
Example:
Look at the following "Orders" table. Now we want to find the largest value of the "OrderPrice" column.
Here is the syntax:
SELECT MAX(column_name) FROM table_name
Example:
Look at the following "Orders" table. Now we want to find the largest value of the "OrderPrice" column.
| OrderId | OrderDate | OrderPrice |
|---|---|---|
| 1 | 2010/11/12 | 1000 |
| 2 | 2010/10/23 | 1600 |
| 3 | 2010/09/02 | 700 |
| 4 | 2010/09/03 | 300 |
| 5 | 2010/08/30 | 2000 |
| 6 | 2010/10/04 | 100 |
This can be done by using this statement:
SELECT MAX(OrderPrice) FROM Orders
Result:
2000
How to connect to MySQL database through PHP?
In PHP, we can connect to the database with the mysql_connect() function.
<?php
mysql_connect("server","user","password") or die(mysql_error());
?>
where "server" is the host name (usually 'localhost'),
"user" and "password" is the username and password for that database respectively.
The "or die(mysql..." code displays an error message in your browser if --you've probably guessed it -- there is an error in processing the connection! Double-check your username, password, or server if you receive this error.
<?php
mysql_connect("server","user","password") or die(mysql_error());
?>
where "server" is the host name (usually 'localhost'),
"user" and "password" is the username and password for that database respectively.
The "or die(mysql..." code displays an error message in your browser if --you've probably guessed it -- there is an error in processing the connection! Double-check your username, password, or server if you receive this error.
How to create Navigation Bar using CSS?
![]() |
| Navigation Bar using CSS Live Demo HTML Part: The HTML part is very simple, the structure is a <ul> list with a <li> element for each link in the navigation bar: <ul> <li><a href="#">Home</a></li> <li><a href="#">Services</a></li> <li><a href="#">About</a></li> <li><a href="#">Contact</a></li> </ul> CSS Part: Copy the css code and paste in the <header> section of your webpage: <style> ul { list-style:none; padding:0px; margin:0px; } li { float:left; } a:link, a:visited { display:block; width:150px; text-align:center; font-family:Tahoma, Verdana; color:#333333; text-decoration:none; padding:6px; font-weight:bold; background-color:#66CCFF; } a:hover { background-color:#6699CC; } </style> |
How to redirect in PHP?
In PHP, header() function is used redirect from one page to another:
<?php
header("Location:http://www.webistuffs.blogspot.com");
?>
<?php
header("Location:http://www.webistuffs.blogspot.com");
?>
How to create a Contact Form with Validation in Dreamweaver?
First of all, select "FORM" from the insert tab as shown in figure(1).
![]() |
| figure(1) |
This will create a form indicated with red dots. [figure(2)]
![]() |
| figure(2) |
Now add a text field like in figure(3).
![]() |
| figure(3) |
Give it a label of Name:
![]() |
| figure(4) |
This will create a text box with label "Name:" [figure(5)]
![]() |
| figure(5) |
Simply repeat a step to create another text field with label "E-mail:" [figure(6)]
![]() |
| figure(6) |
![]() |
| figure(7) |
Now add buttons through which we can submit or reset our form. Select Button
and press OK.
![]() |
| figure(8) |
Now you can see in the below picture that couple of buttons are added to submit and reset our form. But both have the same value i.e. Submit and both will submit the form but we want one to submit and other one to reset the form. For this change the value of the second button as shown in figure(9) and its action to Reset Form.
![]() |
| figure(9) |
Now we have completed our work. The form will look like this:
![]() |
| figure(10) |
Now to validate our form, go to Tag Inspector and open Behaviors tab and click on the plus sign. [figure(11)]
![]() |
| figure(11) |
Select "Validate Form"
![]() |
| figure(12) |
Validate the form as your requirement.
![]() |
| figure(13) |
![]() |
| figure(14) |
Hope its helpful...
Redirection Through Javascript
To create a Javascript redirection, place the following code in the <head> section of your webpage:
<script type="text/javascript"> <!-- window.location = "http://www.webistuffs.blogspot.com" //--> </script>
How to Add favicon icon in the Website?
- Create a 16 pixel wide by 16 pixel high favicon.bmp file in a Program like MS-Paint, Adobe Photoshop , or Jasc's Paint Shop Pro , then use a program (such as the free IrFanView app [for Windows]) to reduce the colors to 16 colors [Image -> Decrease Color Depth], and then 'save as...' to a Windows Icon Format (favicon.ico).
- Upload the image (favicon.ico) to the root section of you site.
- Add the following code to the <head> section of your webpage:
<link rel="icon" type="image/ico" href="favicon.ico" />
What is PHP?
PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.
Nice, but what does that mean? An example:
*************************************************************
************************************************************
Instead of lots of commands to output HTML (as seen in C or Perl), PHP pages contain HTML with embedded code that does "something" (in this case, output "Hi, I'm a PHP script!"). The PHP code is enclosed in special start and end processing instructions
Nice, but what does that mean? An example:
*************************************************************
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Example</title>
</head>
<body>
<?php
echo "Hi, I'm a PHP script!";
?>
</body>
</html>************************************************************
Instead of lots of commands to output HTML (as seen in C or Perl), PHP pages contain HTML with embedded code that does "something" (in this case, output "Hi, I'm a PHP script!"). The PHP code is enclosed in special start and end processing instructions
<?php and ?> that allow you to jump into and out of "PHP mode".
Subscribe to:
Posts (Atom)














