Most answered questions in PHP

+1 vote
1 answer

ERROR: Cannot add or update a child row: a foreign key constraint fails

Hello @kartik, You are getting this constraint check ...READ MORE

Aug 20, 2020 in PHP by Niroj
• 82,880 points
29,461 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,880 points
998 views
0 votes
1 answer

How do I find out my MySQL URL, host, port and username?

Hello @kartik, If you're already logged into the ...READ MORE

Aug 20, 2020 in PHP by Niroj
• 82,880 points
6,040 views
0 votes
1 answer

How can I connect to MySQL in Python 3 on Windows?

Hello @kartik, You should probably use pymysql - Pure Python ...READ MORE

Aug 20, 2020 in PHP by Niroj
• 82,880 points
720 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,880 points
2,249 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,880 points
2,162 views
0 votes
1 answer

How to Import SQL file into mysql?

Hello @kartik, From the mysql console: mysql> use DATABASE_NAME; mysql> ...READ MORE

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

How to check if a string is JSON or not?

Hello @kartik, Use JSON.parse function isJson(str) { ...READ MORE

Aug 19, 2020 in PHP by Niroj
• 82,880 points
8,406 views
0 votes
1 answer

How to convert timestamp to date in MySQL query?

Hello @kartik, Try this: DATE_FORMAT(FROM_UNIXTIME(`user.registration`), '%e %b %Y') AS ...READ MORE

Aug 19, 2020 in PHP by Niroj
• 82,880 points
7,525 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,880 points
1,741 views
0 votes
1 answer

How to remove MySQL root password?

Hello @kartik, You need to set the password ...READ MORE

Aug 19, 2020 in PHP by Niroj
• 82,880 points
10,829 views
0 votes
1 answer

How to alter a MySQL column to be AUTO_INCREMENT?

Hello @kartik, Try this: ALTER TABLE document MODIFY COLUMN ...READ MORE

Aug 19, 2020 in PHP by Niroj
• 82,880 points
2,464 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,880 points
1,899 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,880 points
1,006 views
0 votes
1 answer

How to move columns in a MySQL table?

Hello @kartik, If empName is a VARCHAR(50) column: ALTER ...READ MORE

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

How to see indexes for a database or table in MySQL?

Hello @kartik, To see the index for a ...READ MORE

Aug 18, 2020 in PHP by Niroj
• 82,880 points
146,661 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,880 points
2,281 views
0 votes
1 answer

How do I restore a dump file from mysqldump?

Hello @kartik, It should be as simple as ...READ MORE

Aug 18, 2020 in PHP by Niroj
• 82,880 points
909 views
0 votes
1 answer
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,880 points
4,366 views
0 votes
1 answer

How do you set a default value for a MySQL Datetime column?

Hello @kartik, In version 5.6.5, it is possible ...READ MORE

Aug 18, 2020 in PHP by Niroj
• 82,880 points
7,444 views
0 votes
1 answer

How to get the sizes of the tables of a MySQL database?

Hello @kartik, You can use this query to ...READ MORE

Aug 18, 2020 in PHP by Niroj
• 82,880 points
933 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,880 points
2,154 views
0 votes
1 answer

How to reset AUTO_INCREMENT in MySQL?

Hello @kartik, You can reset the counter with: ALTER ...READ MORE

Aug 18, 2020 in PHP by Niroj
• 82,880 points
544 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,880 points
1,293 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
20,057 views
0 votes
1 answer

How to get WordPress post featured image URL?

Hello @kartik, Try this code below: <?php if (has_post_thumbnail( $post->ID ...READ MORE

Aug 14, 2020 in PHP by Niroj
• 82,880 points
3,153 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,880 points
1,642 views
0 votes
1 answer

How foreach change original array values in php?

Hello @kartik, Do the following: foreach ($fields as $key ...READ MORE

Aug 14, 2020 in PHP by Niroj
• 82,880 points
8,224 views
0 votes
1 answer

How PHP Replace last occurrence of a String in a String?

Hello @kartik, You can use this function: function str_lreplace($search, ...READ MORE

Aug 14, 2020 in PHP by Niroj
• 82,880 points
2,742 views
0 votes
1 answer

Error:Undefined index: barangay in C:\xampp\htdocs\TextBlast\homepage\insert.php on line 22

Hello @ Regina, First checks whether a variable is ...READ MORE

Aug 14, 2020 in PHP by Niroj
• 82,880 points
5,433 views
0 votes
1 answer

Error: Warning: Illegal string offset 'host' in ....

Hello @kartik,  Try this way: $memcachedConfig = array("host" => ...READ MORE

Aug 14, 2020 in PHP by Niroj
• 82,880 points
2,824 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,880 points
4,332 views
0 votes
1 answer

How to get parameters from a URL string?

Hello @kartik, You can use the parse_url() and parse_str() for that. $parts = ...READ MORE

Aug 14, 2020 in PHP by Niroj
• 82,880 points
639 views
0 votes
1 answer

How to get the request parameters in symfony2

Hello @kartik, The naming is not all that ...READ MORE

Aug 14, 2020 in PHP by Niroj
• 82,880 points
2,729 views
0 votes
1 answer

Fatal error: Class 'SoapClient' not found in C:\Program Files (x86)\EasyPHP-5.3.9\www\server.php on line 2

Hello @kartik, To install SOAP in PHP-7 run ...READ MORE

Aug 14, 2020 in PHP by Niroj
• 82,880 points
2,608 views
0 votes
1 answer

How to add slug to href?

Hello @aakash, You are not sending the variable ...READ MORE

Aug 11, 2020 in PHP by Niroj
• 82,880 points
910 views
0 votes
1 answer

Invalid argument supplied for foreach() on line 25. Error in my php and mysql

Hello @viven , This should be a simple fix ...READ MORE

Aug 4, 2020 in PHP by Niroj
• 82,880 points
3,915 views
0 votes
1 answer

Error:No Application Encryption Key Has Been Specified

Hello @kartik, Open command prompt in the root ...READ MORE

Jul 22, 2020 in PHP by Niroj
• 82,880 points
4,217 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,103 views
0 votes
1 answer

How Do I Get the Query Builder to Output Its Raw SQL Query as a String?

Hello @kartik, Use the toSql() method on a QueryBuilder instance. DB::table('users')->toSql() would return: select * ...READ MORE

Jul 22, 2020 in PHP by Niroj
• 82,880 points
839 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,464 views
0 votes
1 answer

Error:Cannot insert explicit value for identity column in table 'table' when IDENTITY_INSERT is set to OFF.

Hello @kartik, You're inserting values for OperationId that is an identity ...READ MORE

Jul 21, 2020 in PHP by Niroj
• 82,880 points
11,187 views
0 votes
1 answer

How to select all records from one table that do not exist in another table?

Hello @kartik, You can either do like this: SELECT ...READ MORE

Jul 21, 2020 in PHP by Niroj
• 82,880 points
51,900 views
0 votes
1 answer

How to drop a table if it exists?

Hello @kartik, No. That will drop the table only ...READ MORE

Jul 21, 2020 in PHP by anonymous
• 82,880 points
541 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,880 points
5,909 views
0 votes
1 answer

How can I do an UPDATE statement with JOIN in SQL Server?

Hello @kartik, This should work in SQL Server: update ...READ MORE

Jul 21, 2020 in PHP by Niroj
• 82,880 points
673 views
0 votes
1 answer

How to Insert multiple rows in a single SQL query?

Hello @kartik, In SQL Server you can insert ...READ MORE

Jul 21, 2020 in PHP by Niroj
• 82,880 points
4,201 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,880 points
2,823 views
0 votes
1 answer

How do I UPDATE from a SELECT in SQL Server?

Hello @kartik, In SQL Server, use MERGE MERGE INTO YourTable ...READ MORE

Jul 21, 2020 in PHP by Niroj
• 82,880 points
717 views