Currently, I'm exploring the use of SQL command preparation in order to prevent any risk of injection. However, I am facing difficulty in understanding how to incorporate SQL statements within the bind_param function. The code snippet I am working wit ...
How can I use JS, JQuery, PHP, and MySQLi to automatically generate an HTML table within a div on a webpage? The table should display data based on user-input search criteria. For example, the user enters a start date and end date, clicks a button, which t ...
Hey everyone, I'm currently working on a simple registration form in PHP and no matter how many times I try to run it, all I get is a blank white page. There are no errors or outputs, just pure emptiness. I was hoping someone could shed some light on ...
Need help updating a table in the database with individual update buttons for each row. The issue is that when the button is clicked, nothing happens because I'm struggling to pass the ID value to the form and then to an UPDATE query. while(list($na ...
Here is my issue: I want only one session to run at a time. Consider the following query: $get_crs_mysqli .= (!empty($_SESSION['userSearch']))?(" AND (course_title like '%".$_SESSION['userSearch']."%') OR (course_title like '%" . $_SESSION['userCategory'] ...
Could use some help with my mysqli_query. It's not inserting into the database, even though it works in phpmyadmin SQL but not on the website. Here is my code: <form action="" method="POST> <input type="email" name="email" placeholder="P ...
My database query is causing an issue, resulting in the error message below: Fatal error: Call to undefined function mysqli_master_query() in /home/**/**/**/edit/add.php on line 4 Take a look at my PHP code snippet: <?php $db = mysqli_connect("lo ...
I need assistance with updating a MySQLi table called "achievements" using PHP in an AngularJS app. The app calculates various statistics, and when a goal is achieved, I send the relevant information to a PHP script using AngularJS's "$http.post" method. M ...
I am looking to transform the array result retrieved from my database query into JSON format using PHP. Below is the code snippet I am currently working with: $row = mysql_fetch_array($result) My goal is to convert the variable $row into JSON format and t ...
Is there a more effective way to enhance security for a public form? I am looking to maximize the security measures in place. <?php ob_start(); $sub_firstname = trim($_POST["firstname"]); $sub_lastname = trim($_POST["lastname"]); $sub_email = trim($_ ...
I am seeking assistance with the following issue: SELECT s.`uid` FROM `sessions` s (I had initially included a LEFT JOIN in the query, but removed it for debugging purposes) For reference, here is the full query: SELECT s.`uid`, u.`username`, u.`email` ...
When I submit a value using my form, I want the date to be saved in the MySQL database. The user does not need to see it, but I need the dates for a future function where I can loop through the registered dates in the database. Do I need to create a hidde ...
Despite my efforts, I can't seem to get json_encode working properly for results retrieved from the fr column in my database. You can find an export of my table at mctrivia.com/language.zip. I have already switched everything to utf8mb4 as recommend ...
My current challenge involves inserting data into a MYSQLi database. When I use the query below, data gets successfully inserted: INSERT INTO table (Name, Phone, Location) VALUES ('test', 'test', 'test') However, instead of using the static value 'test', ...
How can I compare data after connecting to different MySQL databases using mysqli? Database name garden_fruit1, password 123456, database username garden_fruit1. $link1 = mysqli_connect("localhost", "garden_fruit1", "123456" ...
I am relatively new to using jQuery AJAX, so please be patient as I try to explain my situation. I am working on implementing a like button for my website that functions similarly to the Facebook like button. To enable users to click on the like button, th ...
Is there a way to dynamically add radio buttons using jQuery or JavaScript and save the data into a database? I have successfully appended input types such as text, textarea, checkbox, and select with options. Here is my code: <!DOCTYPE html> < ...
My website functions as a messaging application that currently refreshes every 500ms by reading the outputs of the refresh.php file. I'm looking to explore the possibility of triggering the refresh function only when the 'messages' table updates. While ma ...
I am faced with a challenge in my coding project... $query = "SELECT {$selections} FROM {$table_1} UNION ALL SELECT {$selections} FROM {$table_2} UNION SELECT {$selections} FROM {$table_3} UNION SELECT {$selections} FROM {$table_ ...
I am facing an issue with inserting a NULL value into a column named price, which is of type Decimal. The "price" column is nullable and has a default value of NULL. My goal is to insert NULL only when the "price" input field in an HTML form is left empty ...
I manage a website dedicated to dog pedigrees, and I'm trying to display images based on whether the dog is a champion. There are various champions like Italian, French, etc. The code for displaying an image works fine for dogs with "CH" at the begi ...
This is the first query that I've come up with: SELECT DISTINCT(u.nickname) FROM user u where u.id IN(SELECT `submission_user`.`user_id` from `submission_user`) AND u.member_since >= '2015-07- ...
I've been encountering an issue when trying to encrypt a specific data variable. The error message I keep receiving is "PHP Fatal error: Call to undefined function AES_ENCRYPT()...". After conducting some research, it seems that the problem may arise from ...
Currently, I am facing an issue with a mysql table named clients that I utilize to populate the options of a select in one of the rows. The goal is to automatically fill out 2 input fields with client information when a specific option is selected. To acc ...
I have a question about the efficiency of my code, specifically line 16 (as commented). Would using $row to compare with a variable mentioned above be more efficient than writing another SQL query? When I tried using a variable and $row['field name'], it ...
I have created a visually appealing table to showcase data in the following manner: ID name Delete 1 abc Delete 2 def Delete The coding snippet used for the aforementioned display is as follows: <?php $con=mysqli_connect("abc" ...
Currently, I am utilizing mySQL and php to develop a web application. Within my main index.php file, I include: <?php require_once('includes/config.php'); require_once('includes/functionName.php'); ?> This is the content of my config.php file: < ...
I'm attempting to pass a PHP array so that I can use it in JavaScript. The PHP code I have written is shown below: <?php $link = mysqli_connect("localhost", "root", "password", "database"); /* check connection */ if (mysqli_connect_errno()) ...
Here is how I am populating a new table with data: foreach ($results as $key => $val){ $sql = "INSERT INTO submission_meta (key, value) VALUES ('".$key."', '".$val."')"; if ($conn->query($sql) === TRUE) { ...
While attempting to add a new entry to a MySQL table, I encountered an issue with the following queries. When using a parameterized query with mysqli, such as the one shown below, it would work smoothly without any errors: insert into notelist(checksum,de ...
Below is the code snippet : try { if(!($stmt = $conn["DB"]->prepare('CALL `central`.`permissions_edit`(?,?,?,?,?);'))) { $rtn["Errors"][] = "permissions_edit Prepare failed: (" . $conn["DB"]->errno . ") " . $conn["DB"]->error; ...
PHP Notice: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: NO) in G:PleskVhostspeacewithoutlimits.orghttpdocsadminincludesconnect.php on line 8 <?php $servername = "local ...
Yesterday I posted a query regarding displaying an array with commas as columns. You can view the original question here. Today, my progress is as follows: <?php require_once("dbconnection.php"); ?> <?php $sql = "SELECT amount, ingredients FROM ...
Issue with displaying drop down values in the second list, despite trying various solutions. When a user selects a country, the corresponding state should be populated from the database into the second drop-down. Any assistance would be greatly appreciated ...
Establishing a relationship between two tables (login_pre, privilege) looks like this: In the privilege table: +----------------------------------+ | AccessLevel | login_id | pre_id| |----------------------------------| | 1 | 1 | 1 ...
Recently delving into the world of PHP programming, I am seeking assistance with database selection code for MySQL within PHP. After creating a database named "admin" through phpMyAdmin, I noticed the name displayed as "[email protected]". To establis ...
I'm uncertain if this question has been raised previously, but how do we determine the number of parameters received by bind_result()? I attempted to retrieve data from a database and used bind_param. However, an error occurred: Warning: mysqli_stmt::bi ...
Is there a way to improve the code without using mysqli_real_escape_string's in a single MySQL query? //RETRIEVE VALUES $sql = "SELECT * FROM `fddq_product_lang` WHERE id_product='19627' AND id_lang='3'"; $result = mysqli ...
Currently, our main database connection is using mysqli. However, we are considering transitioning to Doctrine DBAL, which is built on top of PDO, a more flexible database abstraction layer. The game plan is to gradually shift from mysqli to DBAL while re ...
After sifting through countless threads, tutorials, and various resources, I've reached out here in the hopes that someone can assist me. Despite trying all suggestions provided, I still haven't been able to resolve the issue. Below is my code s ...
Currently, I am in the process of sending out a newsletter using the code shown below. The code involves a $to variable that contains email addresses stored in my database. To maintain privacy, I have implemented a while loop to send individual emails to e ...
Having trouble pinpointing the issue here - when I bind only one parameter, everything works fine. But when both are present, I encounter the following warning: "Warning: mysqli_stmt::bind_param(): Number of variables doesn't match number of parameters i ...
I am having trouble selecting data from my database using PHP and an ajax call function. In the select function, I am using $_POST to retrieve data from a textbox. Even though I have set up a PHP and ajax call function on my page, something seems to be goi ...
To enhance security measures, I have incorporated a function that handles prepared statements. However, an issue has arisen when attempting to retrieve base64 encoded blob data (approximately 30-50KB) through this method. Unsurprisingly, executing the qu ...
I'm facing an issue with executing the INSERT INTO MySQL statement multiple times within each loop of the while statement. Even though the loop seems to be working correctly based on the number of echoes, the INSERT INTO only works once. In simple terms, ...
This is my first time attempting this and I'm feeling frustrated because I'm struggling to figure out how everything fits together. I have a function that needs to call two PHP files - one for selecting information from a database, and the other ...
I have a DatePeriod object set up using PHP: $start = new DateTime('2016-03-01'); $end = new DateTime('2016-03-01 + 1 month'); $period = new DatePeriod($start, new DateInterval('P1D'), $end); and I also have a SQL Table with work dates: https://i.st ...
Having some issues with my code. Individually, the form and PHP script both work fine, but when combined, I run into trouble. <?php $check = $mysqli->query("SELECT is_member FROM users WHERE username = '$username'"); $isMember = $check ...
I have been struggling with creating a PHP script for updating user hashed passwords. Unfortunately, the script is not functioning as expected and no error messages are being displayed. Every time, it only shows "Your old password is incorrect" message. I ...
Can someone please assist me with this issue I'm encountering? I am attempting to create a table using the provided query, which functions correctly in phpMyAdmin but fails to work within my PHP script. If possible, could you kindly identify any errors in ...
I'm currently facing an issue with converting JSON arrays to JSON format data. The output I am currently getting looks like this: https://i.stack.imgur.com/SW2NW.png However, I would like my output to be in the following format: https://i.stack.imgur.co ...
The comparison fails to evaluate correctly, skipping directly to the else clause even when the values should be equal. The column names in the table match those in the database, so... Should I include quotes in ($recruitcheck==$recruitpass)? $recruiter = ...