Codeigniter mysql where not equal to query
Why dont you use simple $this->db->query('your query');
Codeigniter active record where is not working
This is an issue at the database level, though it is not a bug - this is how SQL works with null values. This query:
SELECT
*
FROM
`table`
WHERE
`user` = 24 AND `is_complete` != 1
will return records where is_complete
is not equal to 1, but not null. If you wish to include null records as well, you will need to do this:SELECT
*
FROM
`table`
WHERE
`user` = 24 AND
(`is_complete` != 1 OR `is_complete` IS NULL)
By comparing a column with a non-null value, you've automatically excluded nulls, which need to be treated with a different syntax.You'll need to add in an additional, bracketed clause for the query; see here for how.
codeigniter: where query in not condition
Just add it to the column part of the where, so
$this->db->select('title')->from('mytable')->where('id !=', $id)->limit(10, 20);
$query = $this->db->get();
Btw, always check the codeigniter manual, it mentions it right with the where()
documentation and it's one of the best documentations you are ever going to find. CodeIgniter Active Records to compare two columns of same mysql table
Try $this->db->where('amount = discount');
Codeigniter active record get rows from two different column value
Thanks to everyone , All give me very useful advise.
I created new query base on @devpro and @cfnerd.
$this->db->where("(property_price BETWEEN $minprice AND $maxprice OR usd BETWEEN $usd_minprice AND $usd_maxprice)");
Now It work!Thanks to all
Related Topics
Mail Not Sending with PHPmailer Over Ssl Using Smtp
How to Automatically Read in Calculated Values with PHPexcel
Determine If User Is Using Proxy
Calling a Stored Procedure from Codeigniter's Active Record Class
Calculate the Difference Between 2 Timestamps in PHP
Use MySQL_Fetch_Array() with Foreach() Instead of While()
Why Is MySQLi_Insert_Id() Always Returning 0
How to Install Gmp for PHP7 on Ubuntu
Selenium2 Firefox: Use the Default Profile
Replace Any Url's Within a String of Text, to Clickable Links with PHP
PHP Warning: Unknown: Input Variables Exceeded 1000
Optimizing MySQL Fulltext Search
What Is the Best Method for Getting a Database Connection/Object into a Function in PHP
How to Get Products from a Particular Category in Magento Ecommerce
How Does This Pcre Pattern Detect Palindromes
Add a Custom Checkbox in Woocommerce Checkout Which Value Shows in Admin Edit Order