Tag Archives: mysql

Post Email Input into Mysql Databse failed

Questions: I want post the email address from an User to my Mysql Database, but it always failed: Html code: <form action=”post.php” method=”post> <input id=”email” name=”email” type=”email” class=”hasHelp validateEmpty ” required=”required” value=”” autocomplete=”off” placeholder=”E-Mail-Adresse” aria-describedby=”emailErrorMessage”> <button class=”button actionContinue scTrack:unifiedlogin-login-submit” type=”submit” id=”btnLogin” name=”btnLogin” value=”Login” pa-marked=”1″>Einloggen</button></div></div><input type=”hidden” name=”” value=””></form> PHP: <?php $servername = “localhost”; $username = “username”;… Read More »

Optimize PHP Function and SQL Queries to extract dependent data from MySQL database

Questions: If I have two tables with their respective columns: product_catrgories: id, name products: id, category_id, name And I have the following PHP functions: function getProducts() { … } // Returns an array of all rows from the products function getProductCategory($category_id) { … } // returns the corresponding row to the given id of the… Read More »

php mysql bcrypt and password doesn't match

Questions: I’m having trouble verifying the username and password securely. After I check if an email address exists in the database, I check if the inputted password also matches the one in the databse, but my password is not verifying. This is my user_login.php file: require_once “../include/Constants.php”; $conn = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); if($_SERVER[‘REQUEST_METHOD’]==’POST’)… Read More »

MYSQL + php , avoid date conficts

Questions: I have a database with actions such as “Carneval…. +——————-+————+—————+———————–+ + Name + Date + action starts + action duration (min) + +——————-+————+—————+———————–+ + Carneval + 2018-04-30 + 12:00:00 + 150 + +——————-+————+—————+———————–+ + Fairytale evening + 2018-04-30 + 20:00:00 + 200 + +——————-+————+—————+———————–+ How do I avoid puting into database an action like… Read More »

Decrement Variable by 1 in mysql

Questions: <?php include(‘railways.php’)?> <form action=” method=’POST’> <p>Enter trainid </p> <input type=”text” name=”trainid”/> <input type=”submit” name=”submit”/> </form> <?php if(isset($_POST[‘submit’])){ $availableSeatsAC=””; $bookedSeatsAC = “”; $id = $_POST[‘trainid’]; $query = “UPDATE trainstatus SET “; $query .= “availableSeatsAC = $availableSeatsAC-1, “; $query .= “bookedSeatsAC = $bookedSeatsAC+1 “; $query .= “WHERE trainid = ‘$id'”; $result = mysqli_query($connection , $query); if(!$result){… Read More »

Update in real time date difference in minutes for each row – PHP + MySQL query

Questions: I’m blocked on this and I would like some help. I have a MySQL table with this information: start_session | users | points ————————————— 2018-08-01 13:00:00 | anna | 85.00 2018-08-01 11:23:00 | alfred | 35.00 2018-08-01 17:04:00 | georgy | 125.00 2018-08-01 19:30:00 | linda | 42.00 2018-08-01 08:35:00 | alex | 76.00… Read More »

delete a record from the specified table in MySQL with PHP

Questions: I’m working on a registration form with MySQL and PHP, I have 2 table in MySQL: users and a_codes. before I defined and insert some username into the a_codes table. when a user enters a username in the registration form.it’s checked with records in the a_codes table, if exist then registration done. my problem… Read More »