Skip to main content

Posts

Showing posts from December, 2013

how to import excel file into mysql database using php script

how to import excel file into mysql database using php script. using   fgetcsv () function to fix this issue. php code : <?php if(isset($_POST["Import"])) { $host="localhost"; // Host name. $db_user="root";//DB User Name $db_password="";//DB Password $db='test'; // Database name. $conn=mysql_connect($host,$db_user,$db_password) or die (mysql_error()); mysql_select_db($db) or die (mysql_error()); echo $filename=$_FILES["file"]["tmp_name"]; echo $ext=substr($filename,strrpos($filename,"."),(strlen($filename)-strrpos($filename,".")));  if($_FILES["file"]["size"] > 0)  {   $file = fopen($filename, "r");          while (($data = fgetcsv($file, 10000, ",")) !== FALSE)          {             //print_r($data);             $sql = "INSERT into user(name,address,email,password) values('".$data[0]."','"

JQuery Get user selected value from select list?

JQuery Get user selected value from select list? jQuery is a Javascript framework.Using jQuery removes a lot of cross browser compatibility issues. <script> function displayVals() {   var singleValues = $( "#single" ).val();   alert(singleValues);   $( "p" ).html( "<b>Single:</b> " + singleValues ); } $( "select" ).change( displayVals ); displayVals(); </script> <select id="single">   <option>Single</option>   <option>Single2</option> </select>

jquery Get textarea input field's value on button clicking event?

jquery Get textarea input field's value on button clicking event? jQuery is a Javascript framework.Using jQuery removes a lot of cross browser compatibility issues. <script> $(document).ready(function() { //alert('test');   $('#total_grp_button').click(function() {     var text_area_val = $('#text_area').val();     alert(text_area_val);      jQuery('#text_area_val1').text(text_area_val);   }); }); </script> <textarea id="text_area" class="new_text" name="text_area"></textarea> <input type="button" name="submit" value="submit" id="total_grp_button">