Tuesday, April 26, 2011

How to find the second heighst record from table


How to find the max price from the given table in sql
SELECT max(price) FROM `productprice`
How to find  the second heist record from table
SELECT `price` FROM `productprice` group by `price` order by `price` desc limit 1,1

Thursday, March 31, 2011

How to make the text box side bar rounded


How to  make  the  text box side bar rounded

If you required that to make the text box side bar rounded  then you can easily  make it by using the css property.
First of all you have to make a simple text box  .
<input type="text" name="site" value="Site Name" style="font-size:24px;"/>
Now you have to make the css property for the text box to make the corner rounded
Thease are as below
.login_fields input[type=text] {width:197px; height:20px;text-shadow: 0px 0px 1px #e4e4e4; border:0px; border-radius: 4px;-moz-border-radius: 6px;-webkit-border-radius: 6px;}

By using this class  when you include the class  in your text field it show the  rounded images .
<div class="login_fields"><input type="text" name="site" value="Site Name" style="font-size:24px;"/>
</div>
 Try it


How to add the  loader  on submit button when submit:

If you want  that when you click on login button then it show the other image of other color and then
 Loader on its side
By using java script property  onclick or by css property you can easily do this. You first have to download the images and name the same name  for images  as given or  can chage accordingly .
<script>
function  visibility()
{
        if(document.images)
    {
         
       
        document.images.loading3.style.visibility = 'visible';
        document.images.loading4.style.visibility='visible';}
       
       }
     </script>

<td><input type="image" src="images/btn_login.png" name="submit"  onclick = "javascript:return validateForm();"/>
            <img src="images/btn_logingrey.png"  border="0" name = "loading1" style = "visibility:hidden;margin-left: 10px;margin-top: -5px;"/></td>
            <td><img src="images/loading3.gif"  border="0" name = "loading2" style = "visibility:hidden;"/></td>

You can also  use this property also  for this 
<input type="image" src="images/btn_go.png" name="submit"style = "visibility:visible; float: left;" onclick="this.style.visibility = 'hidden'; if(document.images){document.images.loading.style.visibility = 'visible';}"/>
<img src="images/loading4.gif" alt="" class="left_flo" name = "loading" style = "visibility:hidden; margin-left:-64px;"/>


Friday, March 4, 2011

Want to Display your Name in heart shape


If you want to display your name in heart shape  then you have to use code of java script given below and an html code
Inception (Two-Disc Edition) [Blu-ray]
First java code  save this file by the name of heart.js
Code is :
function createHeart(sourceId, resultId) {
    objSource = window.document.getElementById(sourceId);
    objResult = window.document.getElementById(resultId);

    if(objSource.value.length == 0) {
        alert("Vikas Gautam Says Enter  Your name in the Text Box!");
        return false;
    }

    string = objSource.value;

    heart = "";
    heart = ". [red][b] \n";
    heart += "_________"               + partString(string, 8)  + "____________" + partString(string, 9)  + "\n";
    heart += "______"                  + partString(string, 14) + "_______"      + partString(string, 16) + "\n";
    heart += "____"                    + partString(string, 19) + "___"          + partString(string, 19) + "\n";
    heart += "___"                     + partString(string, 32) + "_______"      + partString(string, 4)  + "\n";
    heart += "__"                      + partString(string, 32) + "_________"    + partString(string, 4)  + "\n";
    heart += "_"                       + partString(string, 36) + "_______"      + partString(string, 4)  + "\n";
    heart += "_"                       + partString(string, 40) + "______"       + partString(string, 1)  + "\n";
    heart +=                             partString(string, 44) + "__"           + partString(string, 3)  + "\n";
    heart +=                             partString(string, 47) + "_"            + partString(string, 1)  + "\n";
    heart +=                             partString(string, 49)                                           + "\n";
    heart +=                             partString(string, 49)                                           + "\n";
    heart += "_"                       + partString(string, 47)                                           + "\n";
    heart += "__"                      + partString(string, 45)                                           + "\n";
    heart += "____"                    + partString(string, 42)                                           + "\n";
    heart += "______"                  + partString(string, 37)                                           + "\n";
    heart += "_________"               + partString(string, 31)                                           + "\n";
    heart += "____________"            + partString(string, 25)                                           + "\n";
    heart += "______________"          + partString(string, 20)                                           + "\n";
    heart += "_________________"       + partString(string, 13)                                           + "\n";
    heart += "___________________"     + partString(string, 9)                                            + "\n";
    heart += "_____________________"   + partString(string, 6)                                            + "\n";
    heart += "______________________"  + partString(string, 4)                                            + "\n";
    heart += "_______________________" + partString(string, 2)                                            + "\n";
    heart += "create by hack2007.50webs.com";


    objResult.value = heart;
}
function partString(string, num) {
    if(string.length >= num)
        return string.substring(0, num);

    repeat = Math.ceil(num / string.length);

    newString = "";

    for(i = 0; i < repeat; i++)
        newString += string;

    return newString.substring(0, num);
}
HDMI Cable 2M (6 Feet)
After saving this file you need to create  an html file  by which you able to chage your name in heart shape
Name this file as you want   and past this code to this file and save it
<html>
<table align=”center” bgcolor=”green”>
 <tr>
                    <td width="100%" height="74" align="left" valign="top">
      <p style="margin-top: 0; margin-bottom: 0; line-height:150%">
      <font face="Georgia" style="font-size: 11pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      Vikas Gautam  Says Enter   your name </font></p>

      <p style="margin-top: 0; margin-bottom: 0; line-height:150%">
      <font face="Georgia" style="font-size: 11pt">&nbsp;&nbsp;
      <input id="text" name="text" size="20">
                      <input class="button" accesskey="g" onclick="return createHeart('text', 'result');" value=" Heart" type="button"> </font></p>
      <p style="margin-top: 0; margin-bottom: 0; line-height:150%">
      <font face="Georgia" style="font-size: 11pt">
                      <br>
                      <textarea id="result" rows="17" cols="57" onclick="this.focus(); this.select();" readonly="readonly"></textarea>

                                                              <script src="heart.js"></script></font></p>
                    </td>
                  </tr>
                </table>
                </html>
AmazonBasics High Speed HDMI Cable (6.5 Feet / 2.0 Meters) - Supports Ethernet, 3D, and Audio Return [NEW MODEL]
Now you run the html file in html browser  and enter  your name in the text box and click on the  create  heart  button.

Monday, February 14, 2011

Import an .csv file to my sql data base

To import an .csv file todata base of my sql. Youcan easily

import an .csv file to data base by this script


//impot an ,csv file to my sql data base


//Database connection

$con=mysql_connect("localhost","root","");

if(!$con)
{
die('Could not connect: ' . mysql_error());

}
mysql_select_db("artpoly1",$con);



//query on the pree of submit button after selecting file

if(isset($_POST['submit']))
{

$fname = $_FILES['file_name']['name'];


$chk_ext = explode(".",$fname);


if(strtolower($chk_ext[1]) == "csv")

{

// print_r($_FILES['file_name']['tmp_name']);


$filename = $_FILES['file_name']['tmp_name'];


$handle = fopen($filename,'r');


$sql2="INSERT into

import(`file_name`,`timestamp`)values('".$fname."','".date('Y-m-d H:i:s')."')";


mysql_query($sql2);


$id = mysql_insert_id();


while (($data = fgetcsv($handle,1000, ","))!== FALSE)
{

//insert query to the database


$sql ="INSERT into import_sanmar


(`IMPORT_ID`,`UNIQUE_KEY`,`PRODUCT_TITLE`,`SPEC_SHEET`,`PRICE_TEXT`,

`SANMAR_MAINFRAME_COLOR`,`MILL`)

values('".$id."','".mysql_escape_string($data[0])."',

'".mysql_escape_string($data[1])."','".mysql_escape_string($data[2])."',

'".mysql_escape_string($data

[3])."','".mysql_escape_string($data[4])."','".mysql_escape_string($data[5])."','".my

sql_escape_string($data[6])."')";

//$sql2="INSERT into

import(`sel_file`,`timestamp`)values('$filename','".date('Y-m-d H:i:s')."')";

//$sql1=mysql_query("delete from import where UNIQUE_KEY=0");

mysql_query($sql) or die(mysql_error());

//mysql_query($sql2);

// to delete the first row of field name

//$sql1=mysql_query("delete from import_sanmar where IMPORT_ID=0");


$sql1=mysql_query("delete from import_sanmar where UNIQUE_KEY=0");

}




fclose($handle);

echo "Successfully Imported";
}

else

{

echo "Invalid File";

}

}
?>


form action="'' method='post' enctype="multipart/form-data">


import file: <input type="file" name="file_name" /><br />
<input type="submit" name="submit" />

/form>


by useing this script you can able to import the csv filedata to mysql database.

Wednesday, January 19, 2011

How To Create Word press Theam

You can easily convert any given template in html to the word press

for this you have to first install wordpress on your computer and after that you have to go the the wp-content folder in the word press folder

in the wp-content you get the option of the wp-theams
in the theam folder you have available defoult theam of twentyten you copy that theam and make duplicate past of it and give it the name to your site theam

in your name theam go to the header.php file in this file you enter the header info which is in your html template and not chage the defoult menu funtion wp_nav_menu put it where you want to display your menu

after the on the page.php you can give the page content for the home page
in the side bar you can enter the static sidebar info
or in the footer .php you can enter the footer design info or content

after the you go to your site admin section in this section to go to the
the apearance option in this option you get the option of theam in the theam section you see the available theam that you created or other defoult theam that already activated you have to click your theam and activate it then you can see on your site on wordpress your theam working



Welcome any suggestion or question for more implementation

Wednesday, January 12, 2011

How To upload A image file in php

If you Want to upload an image in php or save any folder or database you can use the upload script

for this you first have to create the upload html form that is like
with html tag :




input type="file" name="file" id="file" /


input type="submit" name="submit" value="Submit" /



after that you have to use the php script to upload the perticular
image file
i.e

?php
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 20000))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "
";
}
else
{
echo "vikas: " . $_FILES["file"]["name"] . "
";
echo "Type: " . $_FILES["file"]["type"] . "
";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb
";
echo "Stored in: " . $_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"],
"vikas/" . $_FILES["file"]["name"]);
echo "Stored in: " . "vikas/" . $_FILES["file"]["name"];
}
}
}
else
{
echo "Invalid file";
}
?>

here we check the condition for the file the file is of the type jpeg
gif , or pjpg type by which other file show invalid
the give file image uploaded by pressing the submit button or it save in the folder vikas as you already created

Bing Map problem with Opera not working on drawing onclick

Today testing my Bing map application on opera
I attach 'onclick' event of bing maps to a function "OnMapClick

map.AttachEvent("onclick", OnMapClick);

in which i am expecting to track Mouse button clicks. i need to check which button is clicked right or left.

var OnMapClick=function(e)
{
var x = e.mapX;
var y = e.mapY;
var pixel = new VEPixel(x, y);
var LL = map.PixelToLatLong(pixel);
alert(e.leftMouseButton);
}

var OnMapClick=function(e)
{
var x = e.mapX;
var y = e.mapY;
var pixel = new VEPixel(x, y);
var LL = map.PixelToLatLong(pixel);
alert(e.leftMouseButton);
}



In Firefox, IE8 and Chrome If works fin but in Opera onclick drawng it showing problum on stop right click or left click event not working

Still looking for solution for this problem. :(