All Questions
20 questions
How to fix "mysqli_query() expects parameter 2 to be string" error
Question ID: 20
I'm getting this error when trying to execute a database query:
"mysqli_query() expects parameter 2 to be string"
Here's my code:
$query = "SELECT * FROM table_name WHERE column = '" . $query . "'"...
1 Answer
279 Views
24 Votes
How to fix "Call to undefined method bind_param()" error
Question ID: 19
I'm getting this error in my PHP application:
"Uncaught Error: Call to a member function bind_param()"
This happens when I try to use prepared statements with MySQLi. What causes this error and how ...
1 Answer
217 Views
20 Votes
What is PHP and why should I learn it?
Question ID: 18
I'm new to web development and I keep hearing about PHP. Can someone explain:
What PHP is and what it's used for
Why it's popular for web development
What kind of applications can be built with PHP
H...
1 Answer
366 Views
1 Votes
Understanding .htaccess RewriteRule with examples
Question ID: 17
I'm trying to understand how .htaccess RewriteRule works for URL rewriting and redirection.
Can someone explain the syntax and provide practical examples of common RewriteRule patterns? I'd like to s...
1 Answer
187 Views
18 Votes
How to change dropdown button text when an item is clicked?
Question ID: 8
I have a Bootstrap dropdown menu, and I want the dropdown button text to change to match the selected item when a user clicks on any dropdown option.
How can I implement this functionality using Java...
1 Answer
126 Views
9 Votes
How to fix PHPMailer SMTP authentication errors?
Question ID: 13
I'm trying to send emails using PHPMailer but I keep getting SMTP authentication errors like:
"SMTP Error: Could not authenticate"
"SMTP Error: Could not connect to SMTP host"
I've double-check...
1 Answer
279 Views
28 Votes
How to install and enable GD library in XAMPP?
Question ID: 12
I need to use the GD library for image processing in my PHP application, but I'm getting errors suggesting it's not installed or enabled.
How can I check if the GD library is installed in XAMPP? If i...
1 Answer
201 Views
19 Votes
How to fix "Trying to get property 'num_rows' of non-object" error?
Question ID: 11
I'm getting this error: "Trying to get property 'num_rows' of non-object"
Here's my code:
// Query
$query = "SELECT * FROM table_name WHERE column = 'value'";
// Preparation
$sql = $conn->prepa...
1 Answer
230 Views
25 Votes
How to store images in a database?
Question ID: 15
I need to store user-uploaded images in my application. I'm considering storing them directly in the database as BLOB data.
What are the best practices for storing images? Should I store them in the ...
1 Answer
220 Views
21 Votes
What is the difference between each() and foreach() in programming?
Question ID: 14
I've seen both each() and foreach() used for iterating over arrays and collections in various programming languages.
What are the key differences between these two approaches? When should I use one o...
1 Answer
138 Views
12 Votes
How to use preg_match with multiple words in PHP?
Question ID: 10
I want to search for multiple words in a string using PHP's preg_match() function.
Here's what I'm trying:
$string = "white red green blue";
$pattern = "/red, blue/";
echo preg_match($pattern, $st...
1 Answer
153 Views
13 Votes
How to insert Hindi/Urdu text into MySQL database using PHP?
Question ID: 9
I need to store Hindi and Urdu text in my MySQL database using PHP. Currently, when I try to insert non-English characters, they appear as question marks or garbled text.
What configuration changes d...
1 Answer
176 Views
16 Votes
How to apply multiple CSS properties using a single jQuery method?
Question ID: 7
I want to apply multiple CSS properties and values to an element using a single jQuery method call.
I tried this syntax but it doesn't work:
$('.myclass').css('background-color': 'red', 'color': 'wh...
1 Answer
131 Views
11 Votes
How to show content when the page is scrolled?
Question ID: 6
I want to create a scroll-triggered animation where a div element becomes visible when the user scrolls down to a certain percentage of the page (like 10% or 50%).
How can I implement this functional...
1 Answer
164 Views
14 Votes
How to print arrays in PHP for debugging?
Question ID: 5
I need to display the contents of a PHP array for debugging purposes. I want to see the structure and values clearly formatted.
My array looks like this:
$array = array('red', 'pink', 'blue', 'white...
1 Answer
216 Views
22 Votes
How to send HTTP response codes in PHP API?
Question ID: 4
I'm building a PHP API and need to send proper HTTP response codes like 200 OK, 404 Not Found, or 500 Internal Server Error.
What's the correct way to set HTTP status codes in PHP? I want to ensure m...
1 Answer
225 Views
18 Votes
Content Security Policy error with Google AdSense frames
Question ID: 16
I'm getting this error in my browser console when loading Google AdSense ads:
"Refused to frame 'https://pagead2.googlesyndication.com/' because it violates the following Content Security Policy"
Th...
1 Answer
203 Views
15 Votes
What is the difference between html() and append() in jQuery?
Question ID: 3
I'm working with jQuery and I'm confused about when to use $("#id").html() versus $("#id").append().
Can someone explain the key differences between these two methods and provide examples of when to ...
1 Answer
203 Views
15 Votes
How to truncate text to multiple lines using CSS?
Question ID: 2
I have a large block of text that spans multiple lines, but I want to truncate it to display only a specific number of lines with an ellipsis (...) at the end.
What CSS properties and techniques can ...
1 Answer
116 Views
12 Votes
How to update data in a database table using phpMyAdmin?
Question ID: 1
I have a table named my_tbl in phpMyAdmin, and I want to update all values in a column named my_col at once.
My current SQL query is:
UPDATE `my_tbl` SET `my_col` = 'B' WHERE `my_tbl`.`id` = *;
The...
1 Answer
154 Views
8 Votes