Skip to content
Advertisement

Tag: php

Search Engine Developement using MySQL relevancy, not working on PHP

i’m working on search engine developement. I’m kinda struggling with an SQL/PHP request. I’m trying to get the highest relevancy score from a search query. It works perfectly on SQL, but not at all on PHP, neither on localhost nor online (while the source code is generated by phpmyadmin itself). Obviously SQL connection works, since other requests are working very

Trying to do basic subtraction from a database table

I’m trying to subtract data based on user input, for example: UPDATE table SET quantity=quantity – * some input value* This is easy if I’m subtracting field by field, where id=1…2…3, but I want to subtract values automatically when I input quantity, so if input is 60, and there is 50 in the first field, remainder would be subtracted from

Left Join – In Eloquent

I would like to connect user table and like table based on the user_id So I have this Model user.php like.php and my query I would like to return the ‘likes’ table inside the ‘user’ but it doesnt work. I would like to left join it. What am I doing wrong? Answer Well, you need to use one-to-many relation to

Occurrence of a string inside another string

I was wondering if there is an easy way to look for a occurrence of a string inside another string. I’m using this query: $checkfileName[0] will be set in a if-statement, where it’s set to GiM1_0. My problem is that the column doesn’t contain that specific string, only a part of it. Image of sql table So is there a

Queries in Laravel – Equivalent to left join

Currently this is my laravel query But unfortunately, I would also like to get the connected data between the company and the user table, user_id for company and id for user this is the table company table: and the user table How to I connect the user under the company array? Answer You need to make a relationship for the

Advertisement