I’m developing a login/register form for my client. Right now I am working on the registration part of the form however I seem to have encountered an issue. I am trying to append the user’s input to a database if it does not currently exist. I’m developing this functionality using PHP version 7. However, the code does not seem to
Tag: php
Multiple JOINs to the same subquery expression
I’ve recently been teaching myself SQL, and have been working on a toy project to do so. Here is a sample schema: As part of this project, I have a query that gets a list of users, with information populated relative to the currently authenticated user. A simplified version of the query looks like this: Then, at some endpoints, I
Multiple form submit in Laravel
Good day everyone, I have a form with multiple inputs in it and I want to pass it onto the database on submit. Here’s what my blade.php looks like: on code: Here’s my attempt to find a solution: on my controller: I’m having the following errors: ErrorException Array to string conversion and when adding an image call to a member
Iterating Through Multiple Rows and Outputting the Result Inside a Function
I have a PHP file for one of my website pages which has all my HTML and PHP code in it. I have a table on the website and I want to populate it with data from an SQL table. I currently have all code (HTML, Javascript, SQL, PHP) in one file called “modules.php”. This is the code I have
How to avoid asking the user to refill all form fields when one field has an error
New to php, would appreciate your help with this: I made a signup form script to validate the user’s input via multiple error handlers. (check valid email, pwd and pwd re-entry match etc). In case the user filled all fields but one had an error (failed to pass the error handler), i wanted to send back the other fields to
Laravel Dynamic DB Relation
I didn’t find any solution so i am asking it here.. The id of Team is related with teams in Match ,for this the solution is easy.. but The Problem is that one Match can have 3/4+ no of teams So i have to make it dynamic … Answer As Per @maki10 The working Solution Is
Laravel sql table error when i try to upload
This is the error i get SQLSTATE[HY000]: General error: 1 table posts has no column named caption (SQL: insert into “posts” (“caption”, “image”, “user_id”, “updated_at”, “created_at”) values (Caption, Why is that post table code blade.php code and i have my PostsController.php as Why is the error coming up? Answer As you are trying to store data into the post table
How to prevent including database config.php from another client?
We have this config.php file: And this structure The index file is accessable via www.example.com/index.php, but the config.php file too (via www.example.com/config.php). Can others just include www.example.com/config.php in there php files and execute code with my $conn? How to prevent this? Answer It’s true that if you leave files in the web root, the web server will execute them when
Get total number of products by brand with multiple categories with PHP and MySQL
I have a query: SELECT brand FROM products WHERE brand='”.$brand.”‘ AND category='”.$id.”‘”.$categories_list.” The idea is to get a count of the total products within a category or across multiple categories by a category ID or IDs by a brand number. The code as it sits: It works correctly when only counting a single category. However, it displays incorrect counts when
Using multiple queries (only one is working)
i would like to allow multiple users to login according to their userID and forward each user to his page. However only the last if condition works. Answer You only need to retrieve the User_type_id from the database and then decide on that which page to go to… Although a couple of major points – you should be using prepared