Interista
-
Posts
18 -
Joined
-
Last visited
Posts posted by Interista
-
-
Does it help if you use "H:i:s" (02:30:45) instead of "G:i:s" (2:30:45)
no , it's not
same problem :$
-
Give us an example of how you are doing it now...
global $currentTime; $currentTime = gmdate('G:i:s', time() + (3 * 3600)); $restTime = mysql_query("SELECT `r_ofrom` , `r_oto` , `rid` , `r_status` FROM `restaurant` "); while ($get_times = mysql_fetch_array($restTime)) { $openFrom = $get_times['r_ofrom']; $openTo = $get_times['r_oto']; $restID = $get_times['rid']; $restStatus = $get_times['r_status']; if ($currentTime > $openFrom && $currentTime < $openTo) { if ($restStatus == 'C') mysql_query("update restaurant SET r_status='O' where rid='$restID'"); } else { if ($restStatus == 'O') mysql_query("update restaurant SET r_status='C' where rid='$restID'"); } }
Are you storing the time as VARCHAR instead of TIME fields ?
No not as VARCHAR , I 'm storing the time as TIME . ex 20:00:00
-
Hello,
I have a restaurants opening times hours stored in MySQL DB for each restaurant as Time . ex 10:00:00 - 22:00:00
the problem is when I compare 7:30 with 22:30 , 7:30 would be more than 22:30 !
So I want to get current time and compare it with the stored one .
-
Hello,
I'm working on Address book , Every address have a edit button .
When press on the edit button for each row , I want to get the address's values and show it into a form , the problem is that the form showing in a Lightbox .
How I can send the address ID and return the values of this address and put it into a Lightbox form ?
-
I'm using jQuery tooltip , so easy to use :
-
Sorry for not being clear , But the problems that I face is hard to do it in the query for me .
because I want to sort result after filter it according to category type .
so as example if I have a 5 rows , and filter it using category type it will be like 3 rows as example .
How I can sort only the 3 rows not the whole result of the first query .
I hope it's a clear now :$
-
So that mean there is no way to do it using like functions in jQuery or anything else .. !
so I should make a functions with queries for all sort facilities available .
-
$sql = "SELECT * FROM `whatever` ORDER BY `category` DESC";
OK I know that , But How I can sort the result of this query like sort it according the category .
the only way use queries ?
-
Hello,
How I can sort MySQL result .
I have to two selects box , Sort by alphabetical and sort by the categories , the two selects box in the same page .
How I can filter the result according of the sort type . Like sort the result by specific category and in the same time sort it from Z to A . / DESC
-
I think I fixed it
like this way :
if (isset($_GET['add'])){ if (!isset($_SESSION['cart_'.$_GET['add']])){ $_SESSION['cart_'.$_GET['add']]='1'; }else{ $_SESSION['cart_'.$_GET['add']]+='1'; } }
-
Hello ,
I got error that said , I got this error only in the first set session , after that the error disappear .
So as example i send ( cart.php?add=302 ) in URL , And this is what I got :
Undefined index: cart_302 in C:\wamp\www\cart.php on line [i]9[/i]
I'm using session for store my cart info , this is my session create code :
if (isset($_GET['add'])){ $_SESSION['cart_'.$_GET['add']]+='1'; }
-
pseudocode
prev_cat = '' while (fetch next row) { if (category != prev_cat { print category prev_cat = category } print product }
U rock
works great
thank u so much for the help
-
That question cannot be answered. The appropriate number of "queries" (or what I think you mean is how much data should be stored) is completely dependent upon the needs of the application. If the needs of the application requires 5 queries or 500 queries then that is what it takes.
To address your specific need, you are wanting to store a user's cart. There are a few different solutions and which one you choose can depend on many factors.
You can use sessions, but they will only persist for the user's session (obviously). This is pretty easy to manager.
You can store the info in cookies, which will persist across sessions. But, if a user saves a cart it would only be available to them on that same pc.
If you want carts to persist across sessions and PCs then you will want to store them in the DB and ties to a user login.
There is no right or wrong method - it depends on which one meets your specific needs. Many sites use several methods.
Oh OK , great info that will help me for sure .
Thanks for help
-
Hello ,
I'm a newbie in PHP but I have tried so much but nth work !
I want to print out products into categories like this way :
Category 1 :
- product 1
- product 2
- product 3
Category 2:
- product 5
- product 7
and so on ..
This is my code which I'm using :
$get_products = mysql_query("select * from ((product join category on cid = p_cid) join restaurant on rid = c_rid) join restaurant_type on rtid = r_rtid where rid = '$rest_id' order by rid, c_sortval, p_sortval"); while ($get_productsrows = mysql_fetch_assoc($get_products)) { echo ' <div class="product-box" id="products-box"> <table width="100%;">'; echo '<tr id="'.$get_productsrows['pid'].'" rel="desc" title="' . $get_productsrows['p_desc'] . '" > <td style="font-weight: bold;font-size:13px;" ><span class="name">' . $get_productsrows['p_name'] . '</span></td> <td style="text-align:center;font-size:11px;" >JD <span class="price">' . $get_productsrows['p_price'] . '+</span></td> <td style="text-align:center;"><input type="submit" value="Add" class="btn-add"></td> </tr> </table></div>';
This is only print out the all products for all categories for the restaurant ID .
- product 1
-
Sorry for reply in this topic ..
But I would to know how I can set sessions in products page that contains cart info .
-
Then you should store the cart info in the database or in SESSION data. But, to answer your question directly you can pass variables from the client to the server using Javascript by performing an AJAX request - which I wouldn't suggest for cart info.
Hello ,
I think it's not good to store the cart info in a database ! so much quires .
is that bad in PHP have much quires ?
Thank u
-
What is the best way that let me can passing values from JS to PHP ..
I have Javascript Shopping Cart , So I need to pass cart items and info to make a query .
And I want to keep the cart info even if someone refresh the page .
Thanks
Comparing Times Php & Mysql
in PHP Coding Help
Posted
I have tried ur way , it works but the only problem with time like that .
if the restaurant open from 10:00:00 AM to the next day 03:00:00 AM ..