-
Posts
52 -
Joined
-
Last visited
Never
Everything posted by aashcool198
-
You simply cracked it! thanks a lot!
-
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?
-
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();
-
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?
-
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))
-
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?
-
Hi... i know my question may sound stupid but i really don't know what is a framework and how can i use it for making stuff. i have downloaded Zend framework but couldn't figure-out what to do with that. Please Help.
-
I have two arrays.. one of firstname $arr_f[] and other is of lastname $arr_l[]... i am displaying the full name as.. for($i=0; $i<10; $i++){ echo $arr_f[].$arr_l[]; } But displayed names are orderless. if i sort $arr_f[] then how will i make sure that firstname and lastname are correctly displayed together. Please Help!
-
When we open php help forum we have option to go to different pages such as : Pages: [1] 2 3 4 5 6 ... 2774 I want exactly this in my website for the comments page as there are going to be several comments and i can't put all of them on one page! Please Help!
-
of course...even after my internship i will continue to work in PHP and all freaks would be my best mates. This tradition of getting help and helping others would go on!
-
hi. I have stored passwords using md5 in database. how can i retrieve the password and mail it to user. i have build mailing function you just tell me how can i retrieve password in original form.
-
One month ago i was almost a newcomer to php and i was supposed to make a software for my company (in which i am doing my internship) in php. I was totally confused and started reading tutorials and searching forums on net. while searching i came to know about PHP-freaks and i joined it. Since then Php freaks have helped me like anything And now because of you people my software has come to a completion. My friends are totally amazed by my growth. It was just possible because of you guys. Please keep helping all because it may mean a lot to someone. Thank You Once Again.
-
This code produces a set of radio buttons in each loop.. So each set of radio buttons is named with a value stored in an array. i.e. $me and each time $me takes value $array[$i]. <form action="<?php echo "insert_skill.php?something=$var"; ?>" method="post"> <?php for ($i = 0; $i < $count; $i++){ $me = $array_id[$i]; echo $me; ?> <tr> <td style = "padding-bottom:20px" ><font face="Arial" size="4"><?php echo $array[$i];?></font></td> <td style = "padding-bottom:20px" valign = "middle" align = "center"> <input type="radio" name = "<?php echo $me; ?>" value="EL"/></td> <td style = "padding-bottom:20px" valign = "middle" align = "center"> <input type="radio" name = "<?php echo $me; ?>" value="IMD"/></td> <td style = "padding-bottom:20px" valign = "middle" align = "center"> <input type="radio" name = "<?php echo $me; ?>" value="EXP"/></td> <td style = "padding-bottom:20px" valign = "middle" align = "center"> <input type="radio" name = "<?php echo $me; ?>" value="NONE"/></td> </tr> <?php }?> <tr><td colspan=5 style = "padding-bottom:20px" align = "right"><b><font color="#587050" face="Arial" size="5"><input type="submit" value="save"></font></td></tr> </form> while submitting the form i am going to another page where i am retrieving the values by this code: $ash = $area[2]; $ashish = $_REQUEST[$ash]; echo $ashish; $area[] in the second page is same as $array_id[] in first page. But $ashish is empty that means value is not retrieved i have checked through several echo's everything else is working but as i am using array variables in both the pages the problem is happening. Please help! if you need some more information please let me know.
-
The html is working correctly even the code is working partially correct. As it takes file and stores it in specified folder. But the file is not stored in database. i think there is some problem in sql command or the way i have written it. I just want to take file from user and store it in database. If someone gets any such code on net please tell me.
-
Hi.. i want user to upload a file which is then stored in my database i have written this code but it is not working. <?php if (isset($_GET['try'])) { $allowed_filetypes = array('.JPG','.jpg','.gif','.bmp','.png'); // These will be the types of file that will pass the validation. $max_filesize = 524288; // Maximum filesize in BYTES (currently 0.5MB). $upload_path = ''; // The place the files will be uploaded to (currently a 'files' directory). $filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension). $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension from the filename. if(!in_array($ext,$allowed_filetypes)) die('The file you attempted to upload is not allowed.'); if(filesize($_FILES['userfile']['tmp_name']) > $max_filesize) die('The file you attempted to upload is too large.'); // Check if we can upload to the specified path, if not DIE and inform the user. // Upload the file to your specified path. if(move_uploaded_file($_FILES['userfile']['tmp_name'],$upload_path . $filename)){ echo 'Your file upload was successful, view the file <a href="' . $upload_path . $filename . '" title="Your File">here</a>'; $instr = fopen("skill.JPG","rb"); $image = addslashes(fread($instr,filesize("skill.JPG"))); $insert = mysql_query ("insert into pix (imgdata) values('$image')"); } else echo 'There was an error during the file upload. Please try again.'; } ?> <HTML> <form action="upload.php?try=true" method="post" enctype="multipart/form-data"> <p> <label for="file">Select a file:</label> <input type="file" name="userfile" id="file"> <br /> <button>Upload File</button> <p> </HTML> </form> Please Help!
-
hi.. i am trying to make a small search engine. where user fills value in form and it is searched in database. $text = $_POST['search']; $q = "SELECT name_id, firstname, lastname FROM personal where firstname LIKE '%'$text'%'"; $query = mysql_query($q); while($row = mysql_fetch_array($query)){ echo $row['firstname']; I think there is some problem with LIKE '%'$text'%'. please tell me the right syntax.
-
Hi.. I want to put a field in my website where people can upload their resume. I have no idea what to do. Please help.
-
<?php echo "<a href=\"man_tech.php?name_id=$array_id[$i]\">$array_f[$i] $array_l[$i]</a>";?> this code is run in a for loop and creates certain links when you click on a link you are directed to another page with respective variable. <a href="man_tech.php?name_id=$array_id[$i]"> that is.. $array_id[$i] is the variable i am passing. How can i use sessions in this case?
-
but can you pass more than one variable using sessions. kindly show me how?
-
hi.. i have a website in which a user can loon and see his details. I am passing variables in url such as: localhost/man_goals.php?name_id=1 But it is highly unsafe as anyone could write the url and open the respective page. can i pass variables in some hidden form. For every page change i have to pass more than 2 variables. Please Help!
-
[SOLVED] Prevent unwanted inserting in database
aashcool198 replied to aashcool198's topic in PHP Coding Help
thanks... its done! -
Hi.. i have created a form. which is having only one field. when user clicks on submit the data is inserted in database. The problem is if the user clicks back-button of browser the data is resubmitted and is stored again in database. How can i prevent this?
-
Hey! thanks a lot to both of you!
-
i input date as: and retrieve it using and add in database: But the date is not inserted in database. echo $deadline; is giving the correct value but it is not inserted in database while the $goal_id is being inserted every time. Please Help!
-
i want to input date using html form. the input will be stored in date format in database. what input field should i use so that user can fill date. Please someone tell me that code.