Jump to content

aashcool198

Members
  • Posts

    52
  • Joined

  • Last visited

    Never

Everything posted by aashcool198

  1. You simply cracked it! thanks a lot!
  2. HI.. my form has one multiple select dropdown box which gives me selected values in an array. I want to know how can i write mysql query so that i get all the results in which any of the selected case is possible. for example if my array is arr[] than i want to write $result = mysql_query("select * from student where name=arr[0] or name= arr[1] or name=arr[2]....so on...."); I don't know how many elements are there in the array hence can't write it directly.. how can i do it?
  3. Hi, i am trying to send data from database into an excel sheet. i have the but it creates a new excel sheet. I want my old template of excel sheet. Is there any way to copy the old template into the new excel file? <? // Connect database. mysql_connect("localhost","root",""); mysql_select_db("indiainterns"); // Get data records from table. $result=mysql_query("select * from name_list order by id asc"); // Functions for export to excel. function xlsBOF() { echo pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0); return; } function xlsEOF() { echo pack("ss", 0x0A, 0x00); return; } function xlsWriteNumber($Row, $Col, $Value) { echo pack("sssss", 0x203, 14, $Row, $Col, 0x0); echo pack("d", $Value); return; } function xlsWriteLabel($Row, $Col, $Value ) { $L = strlen($Value); echo pack("ssssss", 0x204, 8 + $L, $Row, $Col, 0x0, $L); echo $Value; return; } header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download");; header("Content-Disposition: attachment;filename=india.xls "); header("Content-Transfer-Encoding: binary "); xlsBOF(); /* Make a top line on your excel sheet at line 1 (starting at 0). The first number is the row number and the second number is the column, both are start at '0' */ /* xlsWriteLabel(0,0,"List of car company."); // Make column labels. (at line 3) xlsWriteLabel(2,0,"No."); xlsWriteLabel(2,1,"Company"); */ $xlsRow = 12; // Put data records from mysql by while loop. while($row=mysql_fetch_array($result)){ xlsWriteNumber($xlsRow,0,$row['id']); xlsWriteLabel($xlsRow,1,$row['name']); $xlsRow++; } xlsEOF(); exit();
  4. hi.. i have written a PHP code in which i reload the page when user selects a value in dropdown... function reload(form) { var val=form.cat.options[form.cat.options.selectedIndex].value; self.location='form.php?cat=' + val; } the problem with this script is that it can retain only the numbers which is the value of the selected item in the drop-down.I also want to retain the name field which is an input string. How can i do it?
  5. Hi All, i have a file-upload script and this is code for restricting file types it is accepting pdf but denying docx.. please tell me what is going wrong. if ((($_FILES["file"]["type"] == "application/pdf") || ($_FILES["file"]["type"] == "application/doc") || ($_FILES["file"]["type"] == "application/docx")) && ($_FILES["file"]["size"] < 200000))
  6. Hi, Given a string i want to extract sub string before the first space occurs E.g in $string="php freaks"; i want to extract the first word that is "php". if $string = "your name"; i want to extract "your". How can i do it?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.