Trending questions in PHP

0 votes
2 answers

Error:“Cannot Connect to Server - A network-related or instance-specific error”?

Hello, The "sql server error 40" is appears mostly ...READ MORE

Aug 18, 2020 in PHP by Fantazma
• 140 points
28,288 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,050 points
228 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,880 points
23,724 views
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
1,682 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,880 points
20,951 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
925 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
925 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,880 points
24,368 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
411 views
0 votes
1 answer
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,880 points
22,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,880 points
23,372 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,880 points
18,062 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,880 points
20,268 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,880 points
17,513 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
18,117 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,880 points
17,266 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,880 points
20,131 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,880 points
16,424 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,880 points
16,451 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,880 points
19,943 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,880 points
16,108 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,880 points
19,057 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,880 points
21,697 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,880 points
14,589 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,880 points
16,459 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,880 points
16,982 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,880 points
13,152 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,880 points
17,080 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,880 points
19,062 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,880 points
10,987 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,880 points
13,770 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,880 points
10,905 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,880 points
20,431 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,880 points
13,616 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,880 points
17,406 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,880 points
14,172 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,880 points
13,860 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,880 points
11,287 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,880 points
11,611 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,880 points
10,989 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,880 points
9,301 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,880 points
10,541 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,880 points
13,214 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,880 points
9,350 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,880 points
11,458 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,880 points
8,783 views
0 votes
1 answer

How to upload and Save Files with Desired name using php?

Hello, You can try this, $info = pathinfo($_FILES['userFile']['name']); $ext = ...READ MORE

Nov 4, 2020 in PHP by anonymous
• 82,880 points
9,009 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,880 points
8,793 views
0 votes
1 answer

How can I use break or continue within for loop in Twig template?

Hello @kartik, This can be nearly done by setting a ...READ MORE

Oct 22, 2020 in PHP by Niroj
• 82,880 points
9,278 views