Jump to content

lasha

Members
  • Posts

    45
  • Joined

  • Last visited

Everything posted by lasha

  1. CroNiX thank you for the support and attention. This is not a mask for what I did, I did it because of lack of time. Inevitably, in the near future, I'll do it as you suggested. When I finish, I'll come back and write about how I did and what I got. Thank you again
  2. Barand OMG it seems to work!!! Perfect Answer! :D
  3. Ok i used STR_TO_DATE()... But i wanted to know how to write correctly the qery WHERE piece. name | start_date | end_date rocky | 08/09/2014 | 08/12/2014 nancy | 08/13/2014 | 08/15/2014 arry | 08/16/2014 | 08/19/2014 This is where i came now... WHERE STR_TO_DATE(start_date, '%m-%d-%Y') BETWEEN STR_TO_DATE(start_date, '%m-%d-%Y') - INTERVAL 3 DAY AND STR_TO_DATE(start_date, '%m-%d-%Y') but it doesn't work
  4. CroNiX its varchar cyberRobot but there is 5000+ record in db Is there any other way to do that... i don't care in this step if it will be slow search time. I have no time for modifying this huge script for now... I have a panic
  5. Barand yes it is the date fromat. damn what to do? if i use STR_TO_DATE() what will heppen?
  6. cyberRobot thank you for attention There is db records: name | start_date | end_date rocky | 08/09/2014 | 08/12/2014 nancy | 08/13/2014 | 08/15/2014 arry | 08/16/2014 | 08/19/2014 I want to show records 3 day before start_date ... this is the goal... t must count down 3 days, 2 days ,1 days. thanks
  7. Yes it is close to it but i explain better, if start date is 8 and today is 5th, i want to show this record between 5 and 8. So i thought if it there will be between start_date (8th) minus 3 day and start_date. Is this good logical solution?
  8. Thank you for post Im trying to get records 3 days earlier before start date... and when start date will be today it must dissapear. Thats all story... Output must be names with start date: Rocky Star Plastic - 08/05/2014 I have no idea how to write it correctly
  9. No no im going crazy... i cant figure out how to write correctly. I tryed every combination and it doesnt show what i need... why it is so hard to do...? "SELECT metal, plastic, all_matts, instrmnts FROM take WHERE start_date BETWEEN ADDDATE('start_date', INTERVAL 3 DAY) AND start_date"; im new to all this and dont know how to write it correctly.. plz help
  10. I made research but I can't reach the goal... Don't know what am i doing wrong... can you help with this? i don't know how to write correctly WHERE start_date BETWEEN start_date -3 day AND start_date Thanks
  11. Thanks for post Jacques1, I want to show records 3days erlier before it starts and if started it must dissapear
  12. Hellow, i need help please, writing code and it doesn't work. please help... Here it is WHERE start_date BETWEEN 'start_date".strtotime('-3 day')."' AND 'start_date'"; without this code everithing works fine Thank you
  13. Thank you very much Psycho... I successfully added to my module, code that you provided for me. It did the thing. I'll keep in mind every word you say. Thank you again This is current working code. And it works perfectly ) $query2 = "SELECT car.id, car.model, car.engine, car.passenger, car.liters, car.transmission, car.doors, car.engine_type, car.luggage, car.condintioner, car.stereo, car.gps, car.propulsion, car.price1, car.price2, car.price3, car.price4, car.img, car.thumb, car.owner, car.location, car.state FROM car WHERE car.id NOT IN ( SELECT car_id FROM books WHERE books.start_date < '{$requestEnd}' AND books.end_date > '{$requestStart}' ) AND car.cat_id = $cat_id AND car.location = 'london' AND car.state = 'published'";
  14. Thanks for helping Psycho, it is correct ideas what you gave to me, i guess my query was illogical but to succesfully accomplish this idea i need more help becouse my query is more complex than i posted above. How to translate at your way? I stuck here This is real query in my booking module SELECT car.id, car.model, car.engine, car.passenger, car.liters, car.transmission, car.doors, car.engine_type, car.luggage, car.condintioner, car.stereo, car.gps, car.propulsion, car.price1, car.price2, car.price3, car.price4, car.img, car.thumb, car.owner, car.location, books.car_id, books.start_date, books.end_date FROM car LEFT JOIN books ON car.id = books.car_id WHERE car.cat_id = $cat_id AND books.car_id IS NULL AND car.location = 'london' AND car.state = 'published' OR car.cat_id = $cat_id AND books.start_date NOT BETWEEN '" . $_POST['start'] . "' AND '" . $_POST['end'] . "' AND books.end_date NOT BETWEEN '" . $_POST['start'] . "' AND '" . $_POST['end'] . "' AND car.location = 'london' AND car.state = 'published' GROUP BY car.id"; EDIT: Also, Never use POST data directly in your query. The code above has some logic to prevent malicious input to cause SQL injections. I will keepin mind
  15. Hello all Have a problem with some query and i'll explain it now... I attached image file with tables which i have SELECT car.id, car.model, books.id, books.car_id, books.start_date, books.end_date FROM car LEFT JOIN books ON books.car_id = car.id WHERE books.car_id IS NULL OR books.start_date NOT BETWEEN '" . $_POST['start'] . "' AND '" . $_POST['end'] . "' AND books.end_date NOT BETWEEN '" . $_POST['start'] . "' AND '" . $_POST['end'] . "' GROUP BY books.car_id"; when car with id 1 is booked 1 time, car doesnt appears if book date range is matches to users choosen date range, but when car with id 1 is booked 3 times it appears 2 time becouse time range matched only one record of book table. i want that if time rage is matched even for one books record, dont show this car at all.. Please help with this and tanks you p.s. Sorry for my English
  16. Thank you Barand. Yes it is solution. I'll post how i did this SELECT books.id as booksid, books.car_id, books.cat_id, books.name, books.surname, books.country, books.phone, books.notes, books.start_date, books.end_date, books.owner, books.site, car.id, cat.id, car.model, cat.cat_name FROM books LEFT JOIN car ON books.car_id = car.id LEFT JOIN cat ON books.cat_id = cat.id WHERE books.owner = '$owner'"; and echoed like this echo $myrow["booksid"]; Thank you again and again.
  17. Hello all! I'm makeing car booking module and have one problem. Explaining... There is tree joined tables "books", "car" and "cat". When i joining this three table it retrieves ids from table "car", but i want ids from "books" what to do? Can you help? Thanks <?php if($db->connect_errno > 0){ die('Unable to connect to database [' . $db->connect_error . ']'); } $query = " SELECT * FROM books LEFT JOIN car ON books.car_id = car.id LEFT JOIN cat ON books.cat_id = cat.id WHERE books.owner = '$owner'"; $result = mysqli_query($db,$query) or die("Error: ".mysqli_error($db)); $myrow = mysqli_fetch_array($result, MYSQLI_BOTH); if(mysqli_num_rows($result) > 0){ if($db->connect_errno > 0){ die('Unable to connect to database [' . $db->connect_error . ']'); } do { printf ('<tr> <td>'.$myrow["id"].'</td> <td>'.$myrow["model"].'</td> <td>'.$myrow["cat_name"].'</td> <td>'.$myrow["name"].'</td> <td>'.$myrow["surname"].'</td> <td>'.$myrow["country"].'</td> <td>'.$myrow["phone"].'</td> <td>'.$myrow["notes"].'</td> <td>'.$myrow["start_date"].'</td> <td>'.$myrow["end_date"].'</td> <td>'.$myrow["owner"].'</td> <td>'.$myrow["site"].'</td> <td><a href="delete.php?id='.$myrow["id"].'">Delete</a></td> </tr>'); } while ($myrow = mysqli_fetch_array($result)); } else{ echo '<p align="center" style="margin-top:100px;">There are no records...</p>'; } ?>
  18. Ok i dont know what was problem, but i deleted records in db and insert it again and now works fine. i think db records were broken or something. Anyway, thank you very much Barand
  19. Thanks for answer There is 2 owners, and when owner1 is logged in it does filter and shows only owner1 records. But when owner2 - it shows all result for owner1 and owner2 Yes i tried everything what you suggest and all is ok
  20. Hello all This code below works but doesn't filter records by owner. Please help. thanks SELECT * FROM books LEFT JOIN car ON books.car_id = car.id LEFT JOIN cat ON books.cat_id = cat.id WHERE books.owner = '$owner'
  21. Thank you very much! You helped me so much to out from this lane... Thanks
  22. Ou thank you Gristoi ! But i don't understent why it doesn not work becouse i have made something like this in the past and works well can you explain whats wrong with this code? Thanks again
  23. Hello this error is my problem. help me please $query = "SELECT * FROM car WHERE owner = ".$_POST['owner']."";
  24. aahaaa There is $myrow = mysql_fetch_array($result); twice yeah? Thank you jesirose, it was problem and now everything works perfect!! thanks thanks ))))))))
  25. hello I have problem and i think my topic title explains everything ("A-Z selector does not select veri first record from database") I can't understend why, please help Thanks <table width="100%" border="0" > <tr> <td valign="top"> <ul id="items"> <?php $this_link = htmlentities( $_SERVER['PHP_SELF'] ); $letters = range('A', 'Z'); $menu = '<ul id="az">'."\n"; foreach ( $letters as $letter ) { $menu .= '<li><a href="'. $this_link .'?var='. $letter .'">'. $letter .'</a></li>'."\n"; } $menu .= '</ul>'."\n"; if ( isset( $_GET['var'] ) AND in_array( $_GET['var'], $letters ) ){ $result = mysql_query("SELECT * FROM data WHERE band_name LIKE '". $_GET['var'] ."%' ",$db); $myrow = mysql_fetch_array($result); if (!$result) { echo "<p>The operation unsuccessful ... Please contact the administrator by e-mail: lasha.wm@gmail.com <br> <strong>Error:</strong></p>"; exit(mysql_error()); } if(mysql_num_rows($result) > 0) { $myrow = mysql_fetch_array($result); do { printf (" <li> <table style='float:left; margin:0px;'> <tr> <td valign='top' id='header23' style='color:#888888; font-family:arial;'> <div> <span class='vidtitle'><span style='color:#fff; font-size:12px;'><strong>%s</strong></span></span> <br><a href='%s' target='_blank'>Sound Cloud</a> <br> <a href='%s' target='_blank'>%s</a> </div> <br> </td> </tr> </table> </li> ",$myrow["band_name"],$myrow["sound_cloud"],$myrow["social_link"],$myrow["place_in_social"]); } while ($myrow = mysql_fetch_array($result)); } else { echo "<p>Information not found...</p>"; } } else { echo '<p>Please select a letter</p>'; } ?> </ul> <div style="position:absolute; top:1px; left:111px;"><?php echo $menu; ?></div> </td> </tr> </table>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.