Jump to content

jakebur01

Members
  • Content Count

    847
  • Joined

  • Last visited

Community Reputation

0 Neutral

About jakebur01

  • Rank
    Prolific Member
  • Birthday 06/23/1986

Profile Information

  • Gender
    Male
  • Location
    USA
  1. You were right, I had another variable named $end that was causing the problem. I renamed my start and end to datebegin and dateend and it fixed the issue. Thank you.
  2. I added "new" back in. Same error. Fatal error: Uncaught Error: Call to undefined function DateTime(). Stack trace: #0 {main} thrown
  3. Fatal error: Uncaught Error: Call to undefined function DateTime(). Stack trace: #0 {main} thrown
  4. Ok, this is the only code that is not commented out: if(isset($_POST['datestop'])){ $today = date("Y-m-d"); $datestop=$_POST['datestop']; echo "$today<br /><br />$datestop<br /><br />"; $begin = DateTime($today); $end = DateTime($datestop); } Fatal error: Uncaught Error: Call to undefined function DateTime(). Stack trace: #0 {main} thrown
  5. I can comment out the whole page and the error doesn't go away until I comment out: $begin = DateTime($today); $end = DateTime($datestop);
  6. $today = date("Y-m-d"); $datestop=$_POST['datestop']; //echo "$today<br /><br />$datestop<br /><br />"; $begin = new DateTime($today); $end = new DateTime($datestop); $interval = DateInterval::createFromDateString($interval); $period = new DatePeriod($begin, $interval, $end); foreach ($period as $dt) { $dateloop = $dt->format("Y-m-d"); // do other tasks } CyberRobot, this is how I'm using it.
  7. I originally did not have quotes, but added them in to see if it would make any difference. The error goes away when I comment out these two lines. $today and $datestop returns: I can't see anything wrong with it yet either. 2019-10-08 2024-10-08
  8. I am preparing $begin and $end for DatePeriod() but I can't get passed this error "getting the error Recoverable fatal error: Object of class DateTime could not be converted to string". $today = date("Y-m-d"); $datestop=$_POST['datestop']; //echo "$today<br /><br />$datestop<br /><br />"; $begin = new DateTime("$today"); $end = new DateTime("$datestop");
  9. Man, 10 years ago this used to be a hot site! Where did everybody go?
  10. I'm attempting to multiply a number. It does fine unformatted, but when I add number_format and the number is above 1,000 with a comma separator, it has problems. I tried formatting with out the comma, then adding back in after the calculation, but that did not work. $value = 1000; $multiplier = 1.02; for ($i = 1; $i <= 10; $i++) { $value = number_format($value, 2, '.', ''); $value = $value * $multiplier; $value = number_format($value, 2); echo "$$value<br />"; }
  11. What are a few sources for learning the basics?
  12. I've read some of your posts and I feel like you come across as insulting to some of the members who are only trying to learn. You are very smart in the area of PHP and MySQL. I realize some are only looking for someone to write their script instead of learn. But, other people are not likely to come back if they feel stupid every time they post code and ask a question.
  13. How about something like this?: Type id model make category multiple view_all 0 View all F150 Ford Truck F150 Y 1 F150a Ford Truck F150 N 2 F150b Ford Truck F150 N 3 F150c Ford Truck F150 N 4 Viper1 Jetski Boat N 5 Viper2 Jetski Boat N 6 View all Viper3 Jetski Boat Viper3 Y 7 Viper3 Jetski Boat Viper3 N 8 Viper3a Jetski Boat Viper3 N 9 View all Loco2 Train Loco2 Y 10 Loco2 Heavy8 Train Loco2 N 11 Loco2a Heavy8 Train Loco2 N 12 Loco4 Heavy8 Train N
  14. Yes but there will be cases when I will have multiple versions of a model that are not a series of like versions. My current setup is something like this: Type id model make category multiple 1 F150a Ford Truck F150 2 F150b Ford Truck F150 3 F150c Ford Truck F150 4 Viper1 Jetski Boat 5 Viper2 Jetski Boat 6 Viper3 Jetski Boat Viper3 7 Viper3a Jetski Boat Viper3 8 Loco2 Heavy8 Train Loco2 9 Loco2a Heavy8 Train Loco2 10 Loco4 Heavy8 Train In the case above, F150, Viper3, and Loco2 are the only ones that have multiple versions of the same model.
  15. Say you have the following: 1 Sample1a 2 Sample1b 3 Sample1c 4 Sample1d 5 Sample2 6 Sample3 7 Sample3a 8 Sample3b I need to be able to display the data in the following format: View all Sample1 Models Sample1a Sample1b Sample1c Sample2 View all Sample3 Models Sample3 Sample3a Sample3b So, in a select box or a list of links I need to put a "View all" of this model if it has multiple versions of the model. A, B, C, D, etc. I didn't know the best way to do this. Should I add an additional column and put Sample1 in it on the Sample1a, Sample1b, etc. columns. Or should I create another table and use the id's from the first table and add Sample1 next to them. The next issue is how to do the query to where I can stick a View all of this model every time you come to a model that has multiple versions.
×
×
  • 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.