Trending questions in PHP

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, 2020 in PHP by Niroj
• 82,840 points
4,648 views
0 votes
1 answer

How to remove GET-variables with PHP?

Hello @kartik, Try this: preg_replace('/\\?.*/', '', $str) Hope ...READ MORE

Oct 27, 2020 in PHP by Niroj
• 82,840 points
2,216 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, 2020 in PHP by Niroj
• 82,840 points
3,983 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, 2020 in PHP by Niroj
• 82,840 points
3,907 views
0 votes
1 answer

mysql error 'TYPE=MyISAM'

Hello @kartik, Replace TYPE=MyISAM with ENGINE=MyISAM The problem was "TYPE=MyISAM" which should ...READ MORE

Nov 17, 2020 in PHP by Niroj
• 82,840 points
1,277 views
0 votes
1 answer

How to order results with findBy() in Doctrine

Hii @kartik, Try out this code $ens = $em->getRepository('AcmeBinBundle:Marks')               ...READ MORE

Apr 20, 2020 in PHP by Niroj
• 82,840 points
10,354 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, 2020 in PHP by Niroj
• 82,840 points
3,864 views
0 votes
1 answer

How to get name of current directory using php?

Hello @kartik, To get only the name of ...READ MORE

Aug 27, 2020 in PHP by Niroj
• 82,840 points
4,685 views
0 votes
1 answer

How do I get the last inserted ID of a MySQL table in PHP?

Hello @kartik, If you're using PDO, use PDO::lastInsertId. If you're ...READ MORE

Oct 22, 2020 in PHP by Niroj
• 82,840 points
2,232 views
0 votes
1 answer

How to properly indent PHP/HTML mixed code?

Hello @kartik, The PHP and the HTML should ...READ MORE

Oct 30, 2020 in PHP by Niroj
• 82,840 points
1,894 views
0 votes
1 answer

How do I save value in my own session variable in Magento?

Hello @kartik, Try this: $session = Mage::getSingleton("core/session", array("name"=>"frontend")); // ...READ MORE

Nov 17, 2020 in PHP by Niroj
• 82,840 points
1,099 views
0 votes
1 answer

How do I escape a single quote in SQL Server?

Hello @kartik, Single quotes are escaped by doubling ...READ MORE

Jul 21, 2020 in PHP by Niroj
• 82,840 points
6,217 views
0 votes
1 answer

How to fix the session_register() deprecated issue?

Hello, Use $_SESSION directly to set variables. Like this: $_SESSION['name'] = 'stack'; Instead ...READ MORE

Nov 22, 2020 in PHP by Niroj
• 82,840 points
848 views
0 votes
1 answer

How to Check for a Specific Type of Object in PHP

Hello @kartik, You can use instanceof: if ($pdo instanceof PDO) ...READ MORE

Oct 30, 2020 in PHP by Niroj
• 82,840 points
1,796 views
0 votes
1 answer

How can I disable XDebug using php?

Hello @kartik, Find your php.ini and look for XDebug. Set xdebug ...READ MORE

Aug 27, 2020 in PHP by Niroj
• 82,840 points
4,564 views
0 votes
1 answer

How can one check to see if a remote file exists using PHP?

Hello @kartik, You can instruct curl to use ...READ MORE

Nov 10, 2020 in PHP by Niroj
• 82,840 points
1,226 views
0 votes
1 answer

How to set max_execution_time in PHP CLI?

Hello, set_time_limit() works in CLI scripts. <?php set_time_limit(1); //in ...READ MORE

Nov 14, 2020 in PHP by Niroj
• 82,840 points
1,054 views
0 votes
1 answer

How do I specify unique constraint for multiple columns in MySQL?

Hello @kartik, Use this: ALTER TABLE `votes` ADD UNIQUE ...READ MORE

Aug 18, 2020 in PHP by Niroj
• 82,840 points
4,852 views
0 votes
1 answer

How can to make a query with LIKE and get all results with mysqli ?

Hello @kartik, Here's how you properly fetch the ...READ MORE

Nov 17, 2020 in PHP by Niroj
• 82,840 points
828 views
0 votes
1 answer

How to exclude certains columns while using eloquent using php?

Hello @kartik, using hidden array in model is good, but ...READ MORE

Nov 6, 2020 in PHP by Niroj
• 82,840 points
1,292 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 14, 2020 in PHP by Niroj
• 82,840 points
3,588 views
0 votes
1 answer

How to Get $_POST from multiple checkboxes?

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

Sep 15, 2020 in PHP by Niroj
• 82,840 points
3,498 views
0 votes
1 answer

How do I make an asynchronous GET request in PHP?

Hello @kartik, Works with both POST and GET ...READ MORE

Oct 22, 2020 in PHP by Niroj
• 82,840 points
1,844 views
0 votes
1 answer

Error: Premature end of script headers: backup.php

Hello @kartik< Try this settings on my apache.conf: <VirtualHost ...READ MORE

Nov 14, 2020 in PHP by Niroj
• 82,840 points
841 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

Sep 1, 2020 in PHP by Niroj
• 82,840 points
4,028 views
0 votes
1 answer

How do I convert a PDF document to a preview image in PHP?

Hello @kartik, You need ImageMagick and GhostScript <?php $im = new imagick('file.pdf[0]'); $im->setImageFormat('jpg'); header('Content-Type: image/jpeg'); echo ...READ MORE

Aug 14, 2020 in PHP by Niroj
• 82,840 points
4,785 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, 2020 in PHP by Niroj
• 82,840 points
3,333 views
0 votes
1 answer

How to embed PHP code in JavaScript?

Hello, If your whole JavaScript code gets processed ...READ MORE

Nov 9, 2020 in PHP by anonymous
• 82,840 points
986 views
0 votes
1 answer

How to read a list of files from a folder using PHP?

Try this: $files = array_values(array_filter(scandir($path), function($file) use ($path) ...READ MORE

Nov 18, 2020 in PHP by Niroj
• 82,840 points
607 views
0 votes
1 answer

How to know which php.ini is used?

Hello @kartik, ou can use php_ini_loaded_file() Taken from php.net: $inipath = ...READ MORE

Oct 30, 2020 in PHP by Niroj
• 82,840 points
1,403 views
0 votes
1 answer

How do I access static member of a class?

Hello, If A is a class, you can access it ...READ MORE

Nov 20, 2020 in PHP by Niroj
• 82,840 points
458 views
0 votes
1 answer

Fatal error: Cannot access empty property in C:\xampp\htdocs\MyTestPages\f.php on line 15

Hello @kartik, You access the property in the ...READ MORE

Oct 19, 2020 in PHP by Niroj
• 82,840 points
1,873 views
0 votes
1 answer

How to discard a variable from a PHP session array

Hello, Try this: if (isset($_POST['remove'])) { ...READ MORE

Nov 13, 2020 in PHP by Niroj
• 82,840 points
768 views
0 votes
1 answer

How to access array returned by a function in php?

Hello @kartik, Since PHP 5.4 it's possible to ...READ MORE

Nov 10, 2020 in PHP by anonymous
• 82,840 points
861 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 14, 2020 in PHP by Niroj
• 82,840 points
3,339 views
0 votes
1 answer

How do I save value in my own session variable in Magento?

Hello @kartik, Let's say you want to save ...READ MORE

Nov 16, 2020 in PHP by Niroj
• 82,840 points
589 views
0 votes
1 answer

How do I capture PHP output into a variable?

Hello, Try this: <?php ob_start(); ?> <xml/> <?php $xml = ob_get_clean(); ...READ MORE

Nov 3, 2020 in PHP by Niroj
• 82,840 points
1,147 views
0 votes
1 answer

How to Automatically Start a Download in PHP?

Hello @kartik, Send the following headers before outputting ...READ MORE

Nov 5, 2020 in PHP by Niroj
• 82,840 points
1,048 views
0 votes
1 answer

How can I get PHP to produce a backtrace upon errors?

Hello @kartik, My script for installing an error ...READ MORE

Nov 5, 2020 in PHP by Niroj
• 82,840 points
1,000 views
0 votes
1 answer

How to prevent direct access to a php include file?

Hello @kartik, Add this to the page that ...READ MORE

Oct 19, 2020 in PHP by Niroj
• 82,840 points
1,754 views
0 votes
1 answer

How do I embed PHP code in JavaScript?

Hello @kartik, If your whole JavaScript code gets ...READ MORE

Nov 16, 2020 in PHP by Niroj
• 82,840 points
500 views
0 votes
1 answer

How can I get PHP to produce a backtrace upon errors?

Hello @kartik, This is how you do it: set_error_handler(function($errorType){ ...READ MORE

Nov 14, 2020 in PHP by Niroj
• 82,840 points
557 views
0 votes
2 answers

Error:SMTP server response: 530 SMTP authentication is required.

Yes good i like it so nice ...READ MORE

Aug 25, 2020 in PHP by Mani Usman
3,987 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, 2020 in PHP by Niroj
• 82,840 points
2,992 views
0 votes
1 answer

How to enable PHP support in Netbeans?

Hello @kartik, Go to Tools->Plugins. In the Settings tab ensure that the ...READ MORE

Nov 13, 2020 in PHP by Niroj
• 82,840 points
474 views
0 votes
1 answer

Error:Jquery - Uncaught TypeError: Cannot use 'in' operator to search for '324' in

Hello @kartik, You have a JSON string, not ...READ MORE

Jun 16, 2020 in PHP by Niroj
• 82,840 points
6,965 views
0 votes
1 answer

In PHP, how to detect the execution is from CLI mode or through browser ?

Hello @kartik, Use the php_sapi_name() function. if (php_sapi_name() == "cli") { ...READ MORE

Oct 22, 2020 in PHP by Niroj
• 82,840 points
1,418 views
0 votes
1 answer

How to delete from multiple tables in MySQL?

Hello @kartik, Use a JOIN in the DELETE statement. DELETE p, pa ...READ MORE

Aug 26, 2020 in PHP by Niroj
• 82,840 points
3,814 views
0 votes
1 answer

How do I dynamically invoke a class method in PHP?

Hello @kartik, It works both ways - you ...READ MORE

Nov 3, 2020 in PHP by Niroj
• 82,840 points
836 views
+1 vote
2 answers

How to make asynchronous HTTP requests in PHP?

Hello @kartik, Use this code: function post_without_wait($url, $params) { ...READ MORE

Sep 17, 2020 in PHP by Niroj
• 82,840 points
2,642 views