Trending questions in PHP

0 votes
1 answer

How can I declare a global variable in php?

Hello @kartik, The $GLOBALS array can be used instead: $GLOBALS['a'] = ...READ MORE

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

How to get all columns' names for all the tables in MySQL?

Hello @kartik, Try this: select * from information_schema.columns where table_schema ...READ MORE

Aug 19, 2020 in PHP by Niroj
• 82,840 points
2,594 views
0 votes
1 answer

How to export the MySql database structure without the data just the structure?

Hello @kartik, You can do with the --no-data option with ...READ MORE

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

How to convert a string to date in mysql?

Hello @kartik, you can do SELECT STR_TO_DATE(yourdatefield, '%m/%d/%Y') FROM ...READ MORE

Aug 20, 2020 in PHP by Niroj
• 82,840 points
2,523 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, 2020 in PHP by Niroj
• 82,840 points
1,377 views
0 votes
1 answer

How do I get a YouTube video thumbnail from the YouTube API?

Hello @kartik, Each YouTube video has four generated ...READ MORE

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

How to output MySQL query results in CSV format?

Hello @kartik, Using this command columns names will ...READ MORE

Aug 18, 2020 in PHP by Niroj
• 82,840 points
2,564 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 14, 2020 in PHP by Niroj
• 82,840 points
1,382 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, 2020 in PHP by Rohan
• 120 points
971 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, 2020 in PHP by Niroj
• 82,840 points
1,166 views
0 votes
1 answer

How to disable registration new users in Laravel?

Hello @kartik, Laravel 5.7 introduced the following functionality: Auth::routes(['register' ...READ MORE

Aug 24, 2020 in PHP by Niroj
• 82,840 points
2,179 views
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

Sep 28, 2020 in PHP by Niroj
• 82,840 points
476 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, 2020 in PHP by Niroj
• 82,840 points
974 views
0 votes
1 answer

How to add custom javascript to WordPress Admin?

Hello, Use the admin_enqueue_scripts action and the wp_enqueue_script method to add custom ...READ MORE

May 8, 2020 in PHP by Niroj
• 82,840 points
6,560 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, 2020 in PHP by Niroj
• 82,840 points
889 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, 2020 in PHP by Niroj
• 82,840 points
961 views
0 votes
1 answer

Error:MySQL Update Inner Join tables query

Hello @kartik, Try this: UPDATE business AS b INNER JOIN ...READ MORE

Aug 19, 2020 in PHP by Niroj
• 82,840 points
2,073 views
0 votes
1 answer

Error: unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING

Hello @kartik, Make sure they are running Latest ...READ MORE

May 8, 2020 in PHP by Niroj
• 82,840 points
6,450 views
0 votes
1 answer

How to delete a certain row from mysql table with same column values?

Hello @kartik, Add a limit to the delete query delete from orders where ...READ MORE

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

Error: Can't connect to MySQL server on 'my.application.com' (10061)

Hello @kartik, To directly login to a remote ...READ MORE

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

How do I get all posts from $wp_query in the search results in wordpress?

Hello @kartik, Set posts_per_page parameter in args to ...READ MORE

May 8, 2020 in PHP by Niroj
• 82,840 points
6,365 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, 2020 in PHP by Niroj
• 82,840 points
710 views
0 votes
1 answer

Why does the PHP json_encode function convert UTF-8 strings to hexadecimal entities?

Hii @kartik, Working with different servers with various ...READ MORE

Apr 20, 2020 in PHP by Niroj
• 82,840 points
7,125 views
0 votes
1 answer

How can I compare two dates in PHP?

Hello @kartik, If all your dates are posterior ...READ MORE

Aug 27, 2020 in PHP by Niroj
• 82,840 points
1,574 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, 2020 in PHP by Niroj
• 82,840 points
627 views
0 votes
1 answer

How to concatenate text from multiple rows into a single text string in SQL server?

Hello @kartik, Use COALESCE: DECLARE @Names VARCHAR(8000) SELECT @Names = ...READ MORE

Jul 21, 2020 in PHP by Niroj
• 82,840 points
3,077 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, 2020 in PHP by Niroj
• 82,840 points
581 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, 2020 in PHP by Niroj
• 82,840 points
1,174 views
0 votes
1 answer

How do I import an SQL file using the command line in MySQL?

Hello @kartik, Try: mysql -u username -p database_name < ...READ MORE

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

How to insert multiple rows from a single query using eloquent/fluent?

Hello @kartik, You can use the following approach. $data ...READ MORE

Aug 14, 2020 in PHP by Niroj
• 82,840 points
1,836 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, 2020 in PHP by Niroj
• 82,840 points
432 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 14, 2020 in PHP by Niroj
• 82,840 points
493 views
0 votes
1 answer

What does double question mark (??) operator mean in PHP?

Hello, It's the "null coalescing operator", added in ...READ MORE

Apr 2, 2020 in PHP by Niroj
• 82,840 points
7,578 views
0 votes
1 answer

How to create a database from shell command?

Hello @kartik, Try: cat filename.sql | mysql -u username ...READ MORE

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

How to delete duplicates on a MySQL table?

Hello @kartik, This removes duplicates in place, without ...READ MORE

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

How to update column with null value?

Hello @kartik, CREATE TABLE your_table (some_id int, your_column ...READ MORE

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

How to get a list of user accounts using the command line in MySQL?

Hello @kartik, Use this query: SELECT User FROM mysql.user; Which ...READ MORE

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

Error:Internal server errordisplay in PHP via htaccess only

Hello @kartik,  Try adding this line .htaccess: php_flag display_startup_errors ...READ MORE

Sep 1, 2020 in PHP by Niroj
• 82,840 points
841 views
+1 vote
1 answer

How to restore MySQL database from physical files?

Hello @kartik, A MySQL MyISAM table is the ...READ MORE

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

How to convert JSON string to array?

Hello @kartik, If you pass the JSON in ...READ MORE

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

How can I connect to a Tor hidden service using CURL in PHP?

Hello @kartik, I use Privoxy and cURL to scrape Tor ...READ MORE

May 19, 2020 in PHP by Niroj
• 82,840 points
5,320 views
0 votes
1 answer

How to log in to phpMyAdmin with WAMP?

Hello @kartik,  Try-Username: root Password: (No password set). Sometimes it doesn't ...READ MORE

Apr 9, 2020 in PHP by Niroj
• 82,840 points
7,001 views
0 votes
1 answer

How do I recursively delete a directory and its entire contents files as well as sub dirs in PHP?

Hello @kartik, The user-contributed section in the manual ...READ MORE

Aug 24, 2020 in PHP by Niroj
• 82,840 points
1,104 views
0 votes
1 answer

PHP Parse error: syntax error, unexpected T_OBJECT_OPERATOR

Hello @kartik, Change your syntax because it  was invalid. Updated syntax: $purchaseOrder = ...READ MORE

May 19, 2020 in PHP by Niroj
• 82,840 points
5,262 views
0 votes
1 answer

Error:Sending Form file with form using AJAX

Hello @kartik, Don't pass the files into the ...READ MORE

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

How do I check whether a checkbox is checked in jQuery?

Hello @kartik, The checked property of a checkbox DOM element ...READ MORE

Aug 28, 2020 in PHP by Niroj
• 82,840 points
905 views
0 votes
1 answer

How to get the client IP address in PHP ?

Hello, Here is a code sample of a good ...READ MORE

Apr 8, 2020 in PHP by Niroj
• 82,840 points
6,969 views
0 votes
1 answer

Error:Cannot connect to database server Communications link failure

Hello @kartik, Setting the bind-address to the server's network IP ...READ MORE

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

How to print a debug log?

Hello @kartik, A lesser known trick is that ...READ MORE

Aug 24, 2020 in PHP by Niroj
• 82,840 points
982 views
0 votes
1 answer

How to get database structure in MySQL via query

Hello @kartik, Use this: DESCRIBE table; You can also use SHOW ...READ MORE

Aug 26, 2020 in PHP by Niroj
• 82,840 points
874 views