NigelRel3
-
Posts
69 -
Joined
-
Last visited
Community Answers
-
NigelRel3's post in Why my basic insertion won't work? was marked as the answer
You are trying to insert into 3 values for your insert statement and bind only 1.
-
NigelRel3's post in In laravel 5.4 retrieving with several criteria was marked as the answer
You could build an array of conditions, where can take something like...
$binT = \App\BinType::where([['binTypeID', '>', 1], ['sizeX', '<', 10]])->get(); So if you get to the end of all the possible conditions, you can make a choice of including the where only when you know there are criteria to use.
-
NigelRel3's post in Warning: mysqli_error() expects exactly 1 parameter, 0 was marked as the answer
The error is very clear - mysqli_error expects a parameter - usually...
mysqli_error($connection) -
NigelRel3's post in unexpected end of page was marked as the answer
This is a good example of how badly layed out code can make development difficult.
If you laid out the code using something like...
if(condition) { someotherCode(); } The problems may become obvious.
-
NigelRel3's post in check constraint was marked as the answer
Your check if the shirt number already exists is checking that a player_id already exists - nothing to do with the shirt number (or team)!
I'm not sure if your database structure is correct though - if a player is just part of one team - then put the team number on the player record . If you want players to be in multiple teams - then put shirt number of the other record.
Then create a unique key on team, shirt number.
-
NigelRel3's post in Update 2 query in sql using php was marked as the answer
As already mentioned - using multiple statements in one string will not work.
You could rewrite your query though to be something like
UPDATE stock s1, stock s2 set s1.qty = s1.qty-1, s2.qty = s2.qty +1 where s1.id= 1 and s2.id= 1 you'll have to change the names as appropriate - and BIND the variables for the ID's.
-
NigelRel3's post in MYSQL Left Join single row not found in a was marked as the answer
You could use something like
select c.* from customers c where not exists (select 1 from type t where c.customer_id = t.customer_id and t.type in ('macintosh')) All this does is find the people where a record isn't found for a set of types.