56363

Codeigniter Where clause

Question:

Somehow its a bit difficult to for me to build a query like this: Give me all entries of navigation where linkname not null

$query = $this->db->get_where('navigation',array('linkname'!==NULL));

Giving me Error

<blockquote>

Unknown column '0' in 'where clause'

SELECT linkname, idnavigation FROM (navigation) WHERE 0 = 1

</blockquote>

Any hints with this?

Answer1:

You can simply write the WHERE clause manually like this:

$this->db->get_where('navigation', 'linkname IS NOT NULL');

Answer2:

It's :

$query = $this->db->get_where('navigation',array('linkname !=' => NULL));

Answer3:

Try this one...

$this->db->select("*) ->from("table_name") ->where("your_id <>",'');

Answer4:

$this->db->where('linkname !==', NULL); $query = $this->db->get('navigation');

Recommend

  • How to add main title and manipulating axis labels in ggplot2 in Rstudio
  • Android: Check if object is present in database using Room and RxJava
  • How to create a hotspot network in iOS app using Swift
  • Getting an error serving images from App_Themes when using precompilation?
  • MySQL database structure for a webshop
  • ODBC connection to an .accdb file
  • Call a specific instance of a service in Azure Service Fabric
  • Target in barchart in dc.js
  • Insert statement not working using execute(array()) of PDO Extension
  • Making query to find nearest multiple(Lat,Long) from the single(Lat,Long)
  • Get spring boot pagination number starts from 1 instead of 0
  • How to get File path from pdfUri obtained from PDF chooser intent library, in onActivityResult call
  • Custom progress dialog not working
  • Slick: How can I combine a SQL LIKE statement with a SQL IN statement
  • Failed to resolve: firebase-auth-15.0.0 [closed]
  • Please update your Node runtime to version >=0.12.x
  • Get name of days between two date in ios?
  • Thumbnails for mxml components in Flex
  • Year over Year Stats from a Crossfilter Dataset
  • Why is ordered choice in pyparsing failing for my use case?
  • Neo4j…how to get a visual representation of my data?
  • Cloud Code: Creating a Parse.File from URL
  • How to integrate angular2-material (alpha 8.2) with angular2-Quickstart app
  • Why isn't stemDocument stemming?
  • How to encrypt Connectionstring written in web.config from codebehind?
  • How to get rgb from transparent pixel in js
  • Background transfer download task failed when app was closed
  • Cross compile glibc for arm, got undefined reference to some unwind functions
  • PHP Permalinks.. how to change?
  • Write to .csv file with PHP (Commas in Data Error)
  • media foundation H264 decoder not working properly
  • Running R's aov() mixed effects model from Python using rpy2
  • Access to a Matlab gui from the web
  • Create/delete users from text file using Bash script