Trending questions in PHP

0 votes
1 answer

I want to store some photos for a product using sql?

Hello, if you are going to store the ...READ MORE

1 day ago in PHP by Niroj
• 59,480 points
14 views
0 votes
0 answers

How to have SQL injection when using php function?

I'm having sql query as $login = mysql_real_escape_string(GetFromPost('login')); $password ...READ MORE

Sep 23 in PHP by Rohan
• 120 points
28 views
0 votes
2 answers

How to make asynchronous HTTP requests in PHP?

file_get_contents will do what you want $output = ...READ MORE

Sep 22 in PHP by Rajiv
• 140 points
14 views
0 votes
1 answer

Error:PHP Warning: POST Content-Length of 8978294 bytes exceeds the limit of 8388608 bytes in Unknown on line 0

Hello @kartik, 8388608 bytes is 8M, the default ...READ MORE

Sep 17 in PHP by Niroj
• 59,480 points
89 views
0 votes
1 answer

How to get base url in laravel using php?

Hello @kartik, You can use the URL facade ...READ MORE

Sep 17 in PHP by Niroj
• 59,480 points
34 views
0 votes
1 answer

How to delete a file via PHP?

Hello @kartik, The following should help realpath — Returns canonicalized ...READ MORE

Sep 17 in PHP by Niroj
• 59,480 points
29 views
0 votes
1 answer

How do you create optional arguments in php?

Hello @kartik, Use an equals (=) sign in ...READ MORE

Sep 17 in PHP by Niroj
• 59,480 points
23 views
0 votes
1 answer

How to trigger XDebug profiler for a command line PHP script?

Hello @kartik, You can pass INI settings with ...READ MORE

Sep 17 in PHP by Niroj
• 59,480 points
22 views
0 votes
1 answer

How to remove all special characters from a string?

Hello @kartik, This should do what you're looking ...READ MORE

Sep 17 in PHP by Niroj
• 59,480 points
25 views
0 votes
1 answer

How to GET URL parameter in PHP?

Hello @kartik, $_GET is not a function or language ...READ MORE

Sep 17 in PHP by Niroj
• 59,480 points
18 views
0 votes
1 answer

How to display HTML tags as plain text ?

Hello @kartik, Replace < with &lt; and& ...READ MORE

Sep 17 in PHP by Niroj
• 59,480 points
18 views
0 votes
1 answer

How to get the location from an IP address?

Hello @kartik, You could download a free GeoIP ...READ MORE

Sep 17 in PHP by Niroj
• 59,480 points
14 views
0 votes
1 answer

How do I make a redirect in PHP?

Hello @kartik, Use the header() function to send an HTTP Location header: header('Location: '.$newURL); Contrary to ...READ MORE

Sep 16 in PHP by Niroj
• 59,480 points
52 views
0 votes
1 answer

Error:Cannot modify header information - headers already sent by (output started at /some/file.php:12) in /some/file.php on line 23

Hello @kartik, This error message gets triggered when anything is ...READ MORE

Sep 16 in PHP by Niroj
• 59,480 points
32 views
0 votes
1 answer

Error:mysql_fetch_array() expects parameter 1 to be resource, boolean given

Hello @kartik, Error occurred here was due to ...READ MORE

Sep 16 in PHP by Niroj
• 59,480 points
31 views
0 votes
1 answer

How can I get useful error messages in PHP?

Hello @kartik, The following enables all errors: ini_set('display_startup_errors', 1); ini_set('display_errors', ...READ MORE

Sep 16 in PHP by Niroj
• 59,480 points
19 views
0 votes
1 answer

How to secure database passwords in PHP

Hello @kartik, If you're hosting on someone else's ...READ MORE

Sep 16 in PHP by Niroj
• 59,480 points
15 views
0 votes
1 answer

How can I capture the result of var_dump to a string?

Hello @kartik, Try var_export You may want to check out var_export — ...READ MORE

Sep 16 in PHP by Niroj
• 59,480 points
12 views
0 votes
1 answer

How to delete element by value in array (not key) using php?

Hello @kartik, Using array_search() and unset, try the following: if (($key = ...READ MORE

Sep 16 in PHP by Niroj
• 59,480 points
18 views
0 votes
1 answer

How do I get a file extension in PHP?

Hello @kartik, pathinfo() $path_info = pathinfo('/foo/bar/baz.bill'); echo $path_info['extension']; // "bill" Hope ...READ MORE

Sep 16 in PHP by Niroj
• 59,480 points
11 views
0 votes
1 answer

How do I send a POST request with PHP?

Hello @kartik, CURL-less method with PHP5: $url = 'http://server.com/path'; $data ...READ MORE

Sep 16 in PHP by Niroj
• 59,480 points
7 views
0 votes
1 answer

How to Get the full URL in PHP?

Hello @kartik, Have a look at $_SERVER['REQUEST_URI'], i.e. $actual_link = ...READ MORE

Sep 16 in PHP by Niroj
• 59,480 points
12 views
0 votes
1 answer

How to delete object from array inside foreach loop?

Hello @kartik, Use this: foreach($array as $elementKey => $element) ...READ MORE

Sep 15 in PHP by Niroj
• 59,480 points
46 views
0 votes
1 answer

How can I convert the output of PHP's filesize() function to a format with MegaBytes, KiloBytes etc?

Hello @kartik, Here is a sample: <?php // Snippet from ...READ MORE

Sep 15 in PHP by Niroj
• 59,480 points
39 views
0 votes
1 answer

How to generate .json file with PHP?

Hello @kartik, Here is a sample code: <?php $sql="select ...READ MORE

Sep 15 in PHP by Niroj
• 59,480 points
22 views
0 votes
1 answer

How do I get the base URL with PHP?

Hello @kartik, Try this: <?php echo "http://" . $_SERVER['SERVER_NAME'] ...READ MORE

Sep 15 in PHP by Niroj
• 59,480 points
24 views
0 votes
1 answer

How to remove duplicate values from an array in PHP?

Hello @kartik, Use array_unique(): Example: $array = array(1, 2, 2, 3); $array ...READ MORE

Sep 15 in PHP by Niroj
• 59,480 points
24 views
0 votes
1 answer

How to change the session timeout in PHP?

Hello @kartik, Put $_SESSION['login_time'] = time(); into the previous authentication ...READ MORE

Sep 15 in PHP by Niroj
• 59,480 points
20 views
0 votes
1 answer

How can I select and upload multiple files with HTML and PHP using HTTP POST?

Hello @kartik, This is possible in HTML5. Example (PHP ...READ MORE

Sep 15 in PHP by Niroj
• 59,480 points
16 views
0 votes
1 answer

How do I see the extensions loaded by PHP?

Hello @kartik, Running php -m will give you all the ...READ MORE

Sep 15 in PHP by Niroj
• 59,480 points
13 views
0 votes
1 answer

How to copy a file from one directory to another using PHP?

Hello @kartik, You could use the copy() function : // Will ...READ MORE

Sep 15 in PHP by Niroj
• 59,480 points
11 views
0 votes
1 answer

How to Get $_POST from multiple checkboxes?

Hello @kartik, Set the name in the form ...READ MORE

Sep 15 in PHP by Niroj
• 59,480 points
11 views
0 votes
1 answer

How to receive JSON POST with PHP?

Hello @kartik, Try; $data = json_decode(file_get_contents('php://input'), true); print_r($data); echo $data["operacion"]; From your ...READ MORE

Sep 14 in PHP by Niroj
• 59,480 points
39 views
0 votes
1 answer

How to Convert timestamp to readable date/time PHP?

Hello @kartik, Use PHP's date() function. Example: echo date('m/d/Y', 1299446702); Hope it helps!! Thank ...READ MORE

Sep 14 in PHP by Niroj
• 59,480 points
17 views
0 votes
1 answer

How do you Encrypt and Decrypt a PHP String?

Hello @kartik, Use openssl_encrypt and openssl_decrypt You can do something like: $string_to_encrypt="Test"; $password="password"; $encrypted_string=openssl_encrypt($string_to_encrypt,"AES-128-ECB",$password); $decrypted_string=openssl_decrypt($encrypted_string,"AES-128-ECB",$password); Hope it ...READ MORE

Sep 13 in PHP by Niroj
• 59,480 points
47 views
0 votes
1 answer

How to send HTTP response code?

Hello @kartik, you can use http_response_code() for get and set ...READ MORE

Sep 14 in PHP by Niroj
• 59,480 points
13 views
0 votes
1 answer

How to configure XAMPP to send mail from localhost?

Hello @kartik, You can send mail from localhost ...READ MORE

Sep 13 in PHP by Niroj
• 59,480 points
31 views
0 votes
1 answer

How I can make a query with MySQL that checks if the valuein a certain column contains certain data?

Hello @kartik, Try this query: mysql_query(" SELECT * FROM `table` WHERE `column` ...READ MORE

Sep 13 in PHP by Niroj
• 59,480 points
31 views
0 votes
1 answer

Error:PDOException could not find driver

Hello @kartik, You need to have a module ...READ MORE

Sep 13 in PHP by Niroj
• 59,480 points
24 views
0 votes
1 answer

How do I log errors and warnings into a file?

Hello @kartik, Use the following code: ini_set("log_errors", 1); ini_set("error_log", "/tmp/php-error.log"); error_log( ...READ MORE

Sep 13 in PHP by Niroj
• 59,480 points
21 views
0 votes
1 answer

How do I use the json_encode() function with MySQL query results?

Hello @kartik, Use this: $sth = mysqli_query($conn, "SELECT ..."); $rows ...READ MORE

Sep 13 in PHP by Niroj
• 59,480 points
22 views
0 votes
1 answer

How to delete all files from a folder using PHP?

Hello @kartik, Use this: $files = glob('path/to/temp/*'); // get ...READ MORE

Sep 13 in PHP by Niroj
• 59,480 points
22 views
0 votes
1 answer

Notice: Undefined index: bid in C:\xampp\htdocs\userac\courier_management_system-master\courier_management_system-master\addstaff.php on line 130

Hello @saima , Before you extract values from $_POST ,$_SESSION, ...READ MORE

Sep 13 in PHP by Niroj
• 59,480 points
35 views
0 votes
1 answer

Error: Maximum execution time of 60 seconds exceeded in C:\xampp\phpmyadmin\libraries\dbi\mysql.dbi.lib.php on line 140

Hello @kartik, Go to: xampp\phpMyAdmin\libraries\config.default.php Look for : $cfg['ExecTimeLimit'] = 600; You ...READ MORE

Sep 1 in PHP by Niroj
• 59,480 points
79 views
0 votes
1 answer

How to get original URL referer with PHP?

Hello @kartik, Store it either in a cookie or ...READ MORE

Sep 1 in PHP by Niroj
• 59,480 points
89 views
0 votes
1 answer

How to get Root Directory Path of a PHP project?

Hello @kartik, Try $_SERVER['DOCUMENT_ROOT'] contains this path: D:/workspace In that case you ...READ MORE

Aug 31 in PHP by Niroj
• 59,480 points
110 views
0 votes
1 answer

How to get file_get_contents() to work with HTTPS?

Hello @kartik, Try the following script to see ...READ MORE

Sep 1 in PHP by Niroj
• 59,480 points
43 views
0 votes
1 answer

How to increase the execution timeout in php?

Hello @kartik, You need to change some setting ...READ MORE

Sep 1 in PHP by Niroj
• 59,480 points
29 views
0 votes
1 answer

How to get current URL path in PHP?

Hello @kartik, Use $_SERVER['REQUEST_URI'].  The URI which was given in ...READ MORE

Aug 31 in PHP by Niroj
• 59,480 points
56 views
0 votes
1 answer

How to store values from foreach loop into an array?

Hello @kartik, Declare the $items array outside the loop and ...READ MORE

Aug 31 in PHP by Niroj
• 59,480 points
51 views