Trending questions in PHP

0 votes
0 answers

How to display image from database using PHP?

I want to display an image from ...READ MORE

May 11, 2022 in PHP by Kichu
• 19,040 points
812 views
0 votes
1 answer

error: mysqli_connect(): The server requested authentication method unknown to the client [caching_sha2_password] in...

Hello @kartik, Use this SQL command: ALTER USER 'mysqlUsername'@'localhost' ...READ MORE

Oct 27, 2020 in PHP by Niroj
• 82,840 points
24,824 views
0 votes
0 answers

upload image to my server directory and use the url

I want to upload an image to ...READ MORE

May 15, 2022 in PHP by Kichu
• 19,040 points
405 views
0 votes
1 answer

How to call function of one php file from another php file and pass parameters to it?

Hello @kartik, Include the first file into the ...READ MORE

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

How to pass multiple variables to another page in url?

Hello @kartik, Use the ampersand & to glue variables together: $url ...READ MORE

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

Convert a PHP object to an associative array

Start with simply typecasting the line:- $array = ...READ MORE

Feb 23, 2022 in PHP by Aditya
• 7,680 points
2,085 views
0 votes
1 answer

CodeIgniter removing index.php from url

To solve your doubt, use the following ...READ MORE

Feb 23, 2022 in PHP by Aditya
• 7,680 points
1,234 views
0 votes
1 answer

How do I strip all spaces out of a string in PHP?

If I have understood your question right, ...READ MORE

Feb 23, 2022 in PHP by Aditya
• 7,680 points
1,197 views
0 votes
1 answer

How do I convert a string to a number in PHP?

You don't have to do this, since ...READ MORE

Feb 23, 2022 in PHP by Aditya
• 7,680 points
591 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

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

How do I remove quotes from a string?

Hello @kartik, Try this: str_replace('"', "", $string); str_replace("'", "", $string); Otherwise, ...READ MORE

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

How to save DOMPDF generated content to file?

Hii, Try this: require_once("./pdf/dompdf_config.inc.php"); $files = glob("./pdf/include/*.php"); foreach($files as $file) include_once($file); $html ...READ MORE

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

How to connect to SQL Server database from JavaScript in the browser?

Hello @kartik, You shouldn´t use client javascript to ...READ MORE

Jul 21, 2020 in PHP by Niroj
• 82,840 points
23,956 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, 2020 in PHP by Niroj
• 82,840 points
21,927 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, 2020 in PHP by Niroj
• 82,840 points
21,258 views
0 votes
2 answers

How to catch curl errors in PHP?

For (PHP 4 >= 4.0.3, PHP 5, ...READ MORE

Nov 9, 2020 in PHP by anonymous
• 160 points
19,606 views
0 votes
1 answer

How can I access the MySQL command line with XAMPP for Windows?

Hello @kartik, Your MySQL binaries should be somewhere ...READ MORE

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

Warning: mysqli_connect(): (HY000/2002): No such file or directory in /Users/kramer65/Sites/vanilla/info.php on line 3 Failed to connect to MySQL: No such file or directory

Hello @kartik, edit these two lines in /etc/php.ini (or wherever ...READ MORE

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

Fatal error: Constant expression contains invalid operations

Hello @kartik, This is because a static variable ...READ MORE

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

How to return an array from an AJAX call?

Hello @kartik, Use JSON to transfer data types (arrays and ...READ MORE

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

How to remove new lines and returns from php string?

Hello @kartik, You need to place the \n in double ...READ MORE

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

How to check file extension in upload form in PHP?

Hello @kartik, Using if( $ext !== 'gif') might not ...READ MORE

Nov 8, 2020 in PHP by Niroj
• 82,840 points
17,108 views
+1 vote
1 answer

Error: “The zip extension and unzip command are both missing, skipping.”

Hello @kartik, Depending on your flavour of Linux ...READ MORE

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

How to make PDF file downloadable in HTML link?

Hello @kartik, Try this: <a href="./directory/yourfile.pdf" download="newfilename">Download the pdf</a> Where newfilename is ...READ MORE

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

How to Execute PHP function with onclick?

Hello @kartik, In javascript, make an ajax function, function ...READ MORE

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

Fatal error: Class 'Illuminate\Foundation\Application' not found

Hello @kartik, Something is clearly corrupt in your ...READ MORE

Nov 5, 2020 in PHP by Niroj
• 82,840 points
15,462 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, 2020 in PHP by Niroj
• 82,840 points
17,068 views
0 votes
1 answer

How to get the Last Inserted Id Using Laravel Eloquent?

Hello @kartik, Firstly create an object, Then set ...READ MORE

Jul 22, 2020 in PHP by Niroj
• 82,840 points
17,441 views
0 votes
1 answer

How to do error logging in CodeIgniter ?

Hello @kartik, CodeIgniter has some error logging functions ...READ MORE

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

How to Execute php file from another php?

Hello @kartik, It's trying to run it as ...READ MORE

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

How to check if the request is an AJAX request with PHP?

Hello @kartik, Try below code snippet if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) ...READ MORE

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

How can I use jquery $.ajax to call a PHP function?

Hello @kartik, Use $.ajax to call a server context (or ...READ MORE

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

How to get the base domain/url in php?

Hello @kartik, Use SERVER_NAME. echo $_SERVER['SERVER_NAME'] ...READ MORE

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

How to post the parameter in ajax call of jquery datatable?

Hello @kartik, Just pass it like a normal ...READ MORE

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

Error:Lost connection to MySQL server at 'reading initial communication packet', system?

Hello, You have to follow the below steps: bind-address ...READ MORE

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

Error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=MyISAM' at line 9

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

Nov 16, 2020 in PHP by Niroj
• 82,840 points
11,322 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, 2020 in PHP by Niroj
• 82,840 points
14,589 views
0 votes
1 answer

Error:PDOException could not find driver

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

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

How to run composer from anywhere?

Since Composer works with the current working ...READ MORE

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

How can I ping a server port with PHP?

Hello, Try this : echo exec('ping -n 1 -w ...READ MORE

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

How to configuring a xampp web server for different root directory?

Hello @kartik, You can change Apaches httpd.conf by ...READ MORE

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

How to send email with PHPMailer - embed image in body?

Hello @kartik, I found the answer: $mail->AddEmbeddedImage('img/2u_cs_mini.jpg', 'logo_2u'); and on ...READ MORE

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

Error:Unknown column in 'field list' error on MySQL Update query

Hello @kartik, Enclose any string to be passed ...READ MORE

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

How to upload and delete files from dropzone.js?

Hello, For deleting thumbnails you have to enable ...READ MORE

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

How can I use PHP to check if a directory is empty?

Hello @kartik, It seems that you need scandir instead of ...READ MORE

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

How do check if a PHP session is empty?

Hii, I would use isset and empty: session_start(); if(isset($_SESSION['blah']) && !empty($_SESSION['blah'])) { ...READ MORE

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

How to print all session variables currently set?

Hello @kartik, Use this: echo '<pre>'; var_dump($_SESSION); echo '</pre>'; Or you can ...READ MORE

Oct 19, 2020 in PHP by Niroj
• 82,840 points
10,434 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 14, 2020 in PHP by Niroj
• 82,840 points
11,945 views