jagdish kothapalle
-
Posts
5 -
Joined
-
Last visited
Never
Posts posted by jagdish kothapalle
-
-
Hi,
If there is no mysql error and nothing is getting updated, then the where condition is not getting satisfied.
It ought to be either of the two.
-
Debugging is the best way to solve it.
Simplest way would be to echo the query and see the output of the query string. Should solve your purpose.
-
Hi,
I tried replicating the issue and the records are getting inserted properly. I believe the issue got fixed. Kindly close the thread.
-
Hi,
To make it on an illustrative note, you have to convert into timestamp to calculate the difference.
time() function is a php function which gives the current timestamp
unix_timestamp(date) gives you the timestamp of your stored date.
You can use these two timestamp variables in php to calculate the difference which will be in seconds
Error in query
in MySQL Help
Posted
1. For the query,
$qry = "SELECT * FROM `products` where price > avg(price)"
try the below one
$qry = "SELECT * FROM products where price > (select avg(price) from products)"
The mysql engine doesn't understand avg(price) unless you have a variable something like $avgprice (which is already assigned) passed from your php.
2. Ideally, you can use multiple fields in group by clause provided they are also present in the select clause.