logo
down
shadow

Laravel allocate LIKE query not giving results


Laravel allocate LIKE query not giving results

Content Index :

Laravel allocate LIKE query not giving results
Tag : development , By : cautionsign
Date : September 15 2020, 06:00 AM

With these it helps You can not concatenate array like a string.
Since your skills is an array use whereIn method
    public function tasks(){ 
       $skills = Auth::user()->skills;
       $skills = explode (",", $skills); // since you got comma separated skills you need to convert to array
       //$skills =['skill1', 'skill2', 'skill3'];
       $posts = Post::whereIn('category', $skills ); 
       return view('task')->with('posts', $posts);
    } 

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

using the results from query doing further calculations with these results in the same query giving error


Tag : mysql , By : Anand
Date : March 29 2020, 07:55 AM
Hope this helps I'll abreviate some of the column names as they are a bit on the long side, so the query can be more clear:
SELECT  TIMESTAMPDIFF(MONTH,StartDate,EndDate)* ChargePerPeriod As Total,
        DATEDIFF(GREATEST(NOW(),DueDay),StartDate)/30 AS ExpPayments,    
        30* ChargePerPeriod / DATEDIFF(EndDate,StartDate) AS MonthlyAmount,
--->    (Total/MonthlyAmount) as ExpPayments2,     
        member_Id  
FROM membertomships; 
SELECT  TIMESTAMPDIFF(MONTH,StartDate,EndDate)* ChargePerPeriod As Total,
        DATEDIFF(GREATEST(NOW(),DueDay),StartDate)/30 AS ExpPayments,    
        30* ChargePerPeriod / DATEDIFF(EndDate,StartDate) AS MonthlyAmount,
        (TIMESTAMPDIFF(MONTH,StartDate,EndDate)* ChargePerPeriod / (30* ChargePerPeriod / DATEDIFF(EndDate,StartDate))) as ExpPayments2,     
        member_Id  
FROM membertomships; 
SELECT Total, ExpPayments, MonthlyAmount, (Total/MonthlyAmount) as ExpPayments2, member_Id  from
(
  SELECT  TIMESTAMPDIFF(MONTH,StartDate,EndDate)* ChargePerPeriod As Total,
          DATEDIFF(GREATEST(NOW(),DueDay),StartDate)/30 AS ExpPayments,    
          30* ChargePerPeriod / DATEDIFF(EndDate,StartDate) AS MonthlyAmount,
          member_Id  
  FROM membertomships
) as SourceTable

How to query data from 2 mysql tables and join the results together. My attempts keep giving me too many results


Tag : mysql , By : Tim
Date : March 29 2020, 07:55 AM
To fix this issue You need a JOIN condition between the tables, or you get a cartesian product of the two (all rows of table1 multiplied by all rows of table2, or 696^2 in this case).
SELECT
  exp_members.username AS user_login, 
  exp_members.username AS user_nicename, 
  exp_members.email AS user_email, 
  exp_members.url AS user_url, 
  exp_members.screen_name AS display_name, 
  FROM_UNIXTIME(join_date) AS user_registered, 
  exp_member_data.m_field_id_1 AS user_location
FROM
  exp_members
  JOIN exp_member_data 
    /* ON clause specifies the relation between the two tables */
    ON exp_members.username = exp_member_data.username
  JOIN exp_member_data ON exp_members.member_id = exp_member_data.member_id

Raw sql query and query writting using active record query are giving different results


Tag : sql , By : MikeG
Date : March 29 2020, 07:55 AM
this one helps. Either remove the select clause to get full ActiveRecord objects and use includes(:shift_timings) instead, or use pluck to get only the fields you want as an array:
Driver.joins('LEFT JOIN ...') # As in the question
      .pluck('drivers.driver_name, shift_timings.start_hour, shift_timings.start_minutes') 

select query on with relations is not giving the results in laravel eloquent


Tag : php , By : harley.holt
Date : March 29 2020, 07:55 AM
around this issue , in Select you must select the column where you have local key
$records = Student::with(['Mark' => function($marks){
    $marks->select(DB::raw('sum(obtain_marks)'), 'Subject_id' /* same Problem here ->select('subject_id')*/)->with(['Subject' => function($subject){
        $subject->orderby('subject_name')
                ->select(DB::raw('count(subjects.id)','sum(total_marks)','subject_name'));
    }]);
}])
->where('id', $id)
->select('Mark_id') // you must select foreign key column to use relationship
->get();

If then is not giving expected results - laravel


Tag : php , By : jbcrail
Date : December 01 2020, 04:52 PM
hop of those help? I have a notification table, where each row will show a different notification to the user. I'm trying to do the part where if there is a value of 1 in a row, then show a sentence, while if there is a value of 2 then show another sentence. And if I have 2 rows where one of them has 1 while the other with 2 , then show both rows. , This answer is updated according to the feedback. The code should be:
@foreach(auth()->user()->notifics as $notification)

@if($notification->data_type==1)
        <a href="#"> number 1</a>
@elseif($notification->data_type==2)
        <a href="#"> number 2</a>
@endif

@endforeach
Related Posts Related QUESTIONS :
  • mailto link for large bodies
  • Is it just me, or are characters being rendered incorrectly more lately?
  • How do I create an HTML anchor in a FogBugz wiki page?
  • Sleep from within an Informix SPL procedure
  • License Models
  • Rational Purify failing to jump to memory leaks
  • Telligent's Community Server
  • Do people use the Hungarian Naming Conventions in the real world?
  • Memcached chunk limit
  • How do you pull the URL for an ASP.NET web reference from a configuration file in Visual Studio 2008?
  • How to add CVS directories recursively
  • Web App Beta
  • Virtual machine supporting multiple displays
  • LINQ to SQL strings to enums
  • How do I configure eclipse (zend studio 6) to hint and code complete several languages?
  • Recommended Fonts for Programming?
  • Automating VMWare or VirtualPC
  • How do I use more than one OpenID?
  • Domain Specific Language resources
  • Vista or XP for Dev Machine
  • Where can I get the Windows Workflow "wca.exe" application?
  • How to learn ADO.NET
  • What is a good barebones CMS or framework?
  • What's the Developer Express equivalent of System.Windows.Forms.LinkButton?
  • Is it acceptable for invalid XHTML?
  • Anyone soloing using fogbugz?
  • Using MBUnit in TeamCity
  • How to setup a crontab to execute at specific time
  • Linking two Office documents
  • How can I detect if a browser is blocking a popup?
  • Apply filter to t-foreach
  • Lotus Notes convert formula to agent
  • Problem with configuration of odoo for working with pycharm
  • Unexpected number of arguments when calling EM_JS function
  • What does the function state_fidelity() do in Qiskit?
  • Azure function with IoT Hub trigger get send device
  • Cluster similar words using word2vec
  • Add elements into an array then find distinct,
  • Angular8 - error TS2304: Cannot find name
  • Manually polling streams in future implementation
  • How do you perform receipt validation for Android on Xamarin Forms
  • What is the rule behind instruction count in Intel PIN?
  • How to draw some text when click a button in wxWidgets?
  • Restrict entity types in Spacy NER
  • How to animate CN1 Slider progress on load
  • Issue with bwa mem process not running on all output files from previous process
  • Delete videos from playlist using YouTube API
  • How to restart the Hyperledger Composer Playground locally
  • How to configure email alerts in Zabbix Server?
  • Simulator is not working for smart home action with all configured session
  • How parse data using join on Objection.js
  • Assign an array to a property in a Chapel Class
  • Netlogo: How can I obtain the accumulate value in Netlogo?
  • How to populate datasource for listview using api response in react native?
  • Why does gmail API when using history.list method send message ids without the field what action has been preformed on t
  • How to run an append query in ms access vba as part of a transaction
  • Wrong dates shown in Jekyll-based blog
  • How to concatenate two document lists in a webMethods flow service?
  • How to properly set up a site map addition in a customization project
  • IBM Content Collector error calling external Web Service
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com