Jump to content

Sandeep590

Members
  • Posts

    22
  • Joined

  • Last visited

Sandeep590's Achievements

Member

Member (2/5)

1

Reputation

1

Community Answers

  1. Hello Everyone, I have a PHP script which displays all the ISBNs one by one in a browser when I execute the script using XAMPP server. For example : 1) 9783993333332 2) 0502388384 3) 6525356723 4) 9787673287827 5) 097923978X ............ ............ ............ ............ ............ Now , Can anyone help me on how to transfer the output of the PHP script to a text file with the text displayed in it in above format shown as above ? All I need is , to copy the ISBNs to text file using PHP script . Note : All ISBNs should be formatted in a text file in such a way that each ISBN number should starts in next line. Kindly help me on this issue as I would be thankful to you
  2. Hello Everyone, In the process of displaying all the ISBN numbers from the text file, I was using below regular expression which accepts any integer.(In some instances, 10 digit ISBN number ends with X). Regular Expression : preg_match_all('/\d+(?:\d|X)/') Can anyone tell me what would be the regular expression if any alpha digits like A B C .. Z replaces X in the above expression. I have replaced X with [a-z][A-Z] in above regular expression but it dint worked out. With Regards, Sandeep.
  3. Well , thank you so much all for your valuable inputs and suggestions. The regular expression which I have used to extract the 10 digit or 13 digit ISBN number is displayed below. preg_match_all('/\d+(?:\d|X)/',$str,$matches); Where $str is the string which to be parsed and $matches is the output result.
  4. To answer your question number 1 : The input comes from a text file which has been not properly formatted. There is no way that we can format it as it contains huge number of records. To answer your question number 2 : I don't have control on why there is no proper data structure which separates 10 or 13 digit ISBN number from the input textfile. Is there any solution which you can provide me so that i would be thankful to you .
  5. Hello Everyone, I have a problem with the regular expression in PHP. Input Given : 9780735585157 (pbk.;teacher's manual) Expected Output : 9780735585157 For example : 9780735585157 (pbk.;teacher's manual) - Here , I have written a PHP code in such a way to split the portion of text using delimiter ; . so this is making the record to split in two different texts such as 9780735585157(pbk. and teacher's manual. Now, My question is , how to write a php code to replace the (pbk.;teacher's manual) with null or empty so that only 9780735585157 will be displayed in the output. Note that there are other several records with such delimiters in the parenthesis which is making the original text to be displayed in two parts. Kindly help me on this issue. With Regards, Sandeep.
  6. Oh .. ok !! The IP address is provided through php environment variable $_SERVER['REMOTE_ADDR'] and it returns the correct ip address
  7. I dint get what you said !! I have referred in the manual and I don't find answer in it That's the reason I have posted in this forum
  8. Hello Everyone, I have an issue with gethostbyaddr method as it returns an IP address instead of hostname. However , this issue is not seen on all the computers. For example , I see the gethostbyaddr returning the hostname in my machine where as on other systems , it returns the IP address which is incorrect. Can anyone tell me what would be the reason behind it ? echo $_SERVER['REMOTE_ADDR'] returns the IP address of the machine currently logged in whereas $computer_name = substr(gethostbyaddr($_SERVER['REMOTE_ADDR']),0,12) returns the hostname for certain PCs and IP address for other PCs.
  9. Good Evening Folks, Issue : Uploading a file works in local folder ..but not in the remote folder which is on server in WIN SCP.. Description : I have set all the permissions of the folder checked .. However , I don't see the file to be uploaded in the intended path . This is path where the file needs to be uploaded : home/int/libscrip/html/webtest/helpdesk/uploads The code which was written in the PHP file regarding the destination path is as shown below. $my_path = "tmp/"; $my_destinationpath = "uploads/"; if(!file_exists($my_path)) mkdir($my_path,0777,true); if(!file_exists($my_destinationpath) mkdir($my_destinationpath,0777,TRUE); Note : The folder and the file in which the code was written resides in the same folder due to which the above PHP variable was set as "tmp/".. ( Kindly assist me if this is correct practice to specify a folder on remote server).. However , Iam not posting the code related to upload as the code works fine on local without any issues. Unfortunately, this upload functionality is not working on remote server which needs to be solved. Your help is greatly appreciated !!!!
  10. @Jacques1 , Thank you so much for your valuable explanation on the issue. It worked fine when I placed the session_start() at the top of the page where it is the first line in the page. However, I will look into database code to modify it by using PDO concepts. Just for viewers , to understand the issue and how it got resolved 1) As suggested above , when your file contains a mix of PHP and HTML code, it is always preferred to use the PHP code ahead of the HTML code in order for code to work fine 2) Session_start() should be the first line in the page when you are using session variables to pass the data through variables from one page to another page Thanks once again
  11. Attached the code snippet and exact error and warning messages Kindly help me session.txt
  12. 1 warning and 1 notice message were displayed Warning : session_start() : cannot send session cookie - headers already sent by ( output started .............. at line : 405 ) Notice : undefined variable : filename in "Path" at line no : 444
  13. When iam passing the php variables from one page to another page using session variables , the variables are not posted from one page to another. I have used session_start() method as shown below One page ========= <?php session_start(); $_SESSION['sessionvar'] = $_FILES['FileName']['name']; echo $_SESSION['sessionvar'] ; This is working fine where value is displayed Second page ========== <?php session_start(); if(!empty($_SESSION['sessionvar'])) { $filename = $_SESSION['sessionvar']; echo $filename; } However , $filename is not returning the value and it displays the error message saying that undefined index: $filename. Kindly please help me on this issue. Thanks, Sandeep.
  14. Thank you all for your valuable replies. Iam able to upload the file, store the file in a folder , display an attachment which opens the file stored in the folder which was uploaded earlier. I learnt 3 things which will be helpful to the viewers. Therefore , I want to list out those key points. 1) It is efficient to pass the filename by using querystring in a href tag through which the filename will be retrieved by the database. Example : <td><a href="downloadfile.php?file='.$data['Filename'].' ">'.data['Filename'].'</a> 2) It is a good method to use session variables SESSION['sessionvar'] to pass the data through PHP variables from one page to another. In one php page <?php session_start(); $_SESSION['sessionvar'] = $_FILES['FileName']['name']; In another php page session_start(); $filename = $_SESSION['sessionvar']; 3) It is always a good practice to store the data (here in this case : filename ) in the database and later retrieve it based on the conditions assumed. Please let me know for any further information on this post .
×
×
  • 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.