Jump to content

ScoobyDont

Members
  • Content Count

    43
  • Joined

  • Last visited

Everything posted by ScoobyDont

  1. Bitterly disappointed that you need to get your crystal ball out, as an administrator you should know they have bought a Magento 1.0 ecommerce site from theme forest/ebay with a special offer of 42 addons/plugins And what chokes me even more, you have not even offered 2 lines of code to bring the load times down.
  2. Thank you, I fully understand that and thank you for your input, but everything I seem to do with this framework seems to give me problems. So I have ditched it, so I no longer need any more answers on the topic. Yesterday I carried out some testing with Laravel, Cake and CodeIgniter and out of the 3 I personally like CI so going to run with that. Thanks again for all your help
  3. Oh great, to be honest it was to help me start to understand MVC of which I first thought it seemed quite simple until I tried to do a simple bloody count Now I am starting to wonder what ever was wrong with <? $carcount = $db->query("SELECT id FROM vehicledetails WHERE id=id"); $carscounted = $carcount->rowCount(); ?> It was a course on Udemy,(£9.99) and to be fair I thought it had given me an insight into MVC but by your response maybe not. OT but which framework would you recommend for a beginner/advancing php'er
  4. Something like this should work <?php foreach $rows as $row) : ?> <div class="card"> <h4 class="card-title">Card Title</h4> <p class="card-text"> User: <?php echo $row['name']; ?> <br> Date: <?php echo $row['date']; ?> </p> </div> <?php endforeach; ?> Obviously you need to style the card as you see fit
  5. Wow thank you for your detailed repsonse, The MVC is one I followed on a tutorial online, here is a copy of my Database Lib <?php /* * PDO DATABASE CLASS * Connects Database Using PDO * Creates Prepeared Statements * Binds params to values * Returns rows and results */ class Database { private $host = DB_HOST; private $user = DB_USER; private $pass = DB_PASS; private $dbname = DB_NAME; private $dbh; private $error; private $stmt; public function __construct() { // Set DSN $dsn = 'mysql:host=' . $this->host . ';dbname=' . $this->dbname;
  6. hi, I have changed the code a little bit and put everything in my index page to try and to get it to work, I am not getting the Undefined error anymore I am just getting a 0 value with everything I do. The new revised code Model <?php public function countVehicles (){ $this->db->query("SELECT COUNT(id) FROM vehicles WHERE id = :id"); $counter = $this->db->rowCount(); return $counter; } And Controller <?php public function index(){ $counter = $this->vehicleModel->countVehicles(); $data = [ 'counter' => $counter
  7. Hi, thanks for your response I have tried SELECT COUNT, but I still get the same "Undefined index: total" Is there a way I can check if the controller is getting the data?
  8. Hi I will try and explain this as best I can, as I am not sure if the "include" is causing the problem. What I am trying to achieve is count the total number of vehicles in the "vehicles" db table and pass it to views (I have recently moved over to MVC so still learning so please be kind and keep it simple for me please) I have a folder in views called "vehicletracker" , within this folder I have 2 files "index.php" and "widget.php".........The "widget.php" file is an "include" within "index php". The problem I am having is passing data from the controller to the view, I
  9. Hi, I am starting to pick this php business up but I often think if I am doing things right, or if I should treat it as "If it aint broken dont fix it till it is". My login script goes to different directories depending on "role" and I do not know if its the right way of doing things or I am making serious errors with security etc etc My script is <?php if (!empty($_POST['Login'])) { $email = trim($_POST['email']); $password = trim($_POST['password']); if ($email == "") { $login_error = 'Email is required!'; } else if ($password == "") { $
  10. Right Ok, Thank you so much for that I will look into validating the form later and the other parts left me scratching my head, going back to the quote above and #5 The end result is that I have a calendar and in the calendar I want to put events using the "handover" date as the Primary Date 5 days Prior to handover date I would like to put an event in the calendar for "Vehicle Booked for PDI" 2 Days Prior to handover date I would like to put an event in the calendar for "Vehicle Booked for Valet" So you are saying this would be better using queries and not storing the dates in t
  11. Sorry, I am not the worlds best at explaining something I am a novice at but I will try and explain it a little better "The Format is yyyy-mm-dd" I used the same format on the datepicker that Barand gave me of Y-m-d to try and help me and I changed it here(in red) jQuery(function($) { $('.date-picker').datepicker({ startDate: '+10d', format: 'yyyy-mm-dd', autoclose: true, }) //show datepicker when clicking on the icon .next().on(ace.click_event, function(){ $(this).prev().focus(); }); But it gave me a bad output so changed it to yyyy-mm-dd so I could
  12. Sorry I have stripped everything back out, so I can get the DB to accept the form data again as I kept getting errors hoverdate = handover now sorry should of been clearer And yes I do suffer from divititus
  13. Right OK this is the full code with forms etc etc The date format I am using is yyyy-dd-mm I have to use this else Bootstraps Date picker fails and doesnt insert date into DB First the complete form <?php include "includes/header.php"; include "includes/sidebar.php"; $addnew_error_message = ''; $addnew_added_message = ''; if (!empty($_POST['btnAddNew'])) { if ($_POST['reg'] == "") { $addnew_error_message = 'Registration is required!'; } else if ($_POST['chassis'] == "") { $addnew_error_message = 'Chassis No is required!'; } else if ($_POST['handover'] ==
  14. No I am totally lost now, wherever I put the code Barand showed me either gives me an error or the form data does not populate the DB
  15. The form is all working and adding to the database, or should I say it was before I tried doing this I just put an example dummy form up ) so there wasn't a mass of unneeded html
  16. Thanks for the advice, I wanted to store the dates in the DB as I have another 5 dates to deal with not just the one, I wanted to get one working first before I progressed onto the next
  17. Sorry to sound stupid but where in the code does that go
  18. Hi, Can someone point me in the right direction on how to do this I have a form (I have condensed it down to stop complicating things) <input type="text" name="regid"/> <input type="text" name="controlno"/> <input type="text" name="hoverdate"/> <button>My Submit Button</button> The php function public function Addnew($regid, $controlno, $hoverdate) { try { $query = $db->prepare("INSERT INTO addnew(regid, controlno, hoverdate) VALUES (:regid,:controlno,:hoverdate)"); $query->bindParam("regid", $regi
  19. Hi, Sorry lost you a little, this is the db Obviously it has'insert_time' and 'update_time' which is all well and good I am struggling to understand or get to grips with what I have to do to keep 'update_time' static for front end as like my image in OT What I want is:- Previous States status 1 = updated @ 20.09 Current State status 2 = updated @ 20.11 But currently if I changed the status to 2 I would get this results Previous States status 1 = updated @ 20.11 Current State status 2= updated @ 20.11 Would I be best to do 'fwrite' to a new file or
  20. Hi, I have managed to get it partially working but now stuck again, When I change the status the time changes in the db..which is what I wanted I will now try and explain what I want to do next When I change from Status 1 to Status 2 is it possible to grab the time of status change and make it static so it wont change when the status alters in the db again from 2-3 Will I need another column in the db or is there something I can do with php Thanks in advance
  21. Ooops my bad, sorry But thanks for adding the solution for me.
  22. Hi Is it possible to go above 12mths using %m, so for example 5 years = 60mths I am using this code to change the colour of panels which works ok until I make the due date 1yr 2 mths away it makes the panel go red, I need it to stay green and echo 14 mths <?php $expire = $dates->datedue; $date = new DateTime($expire); $now = new DateTime(); ?> <div class="col-md-3"> <div class="panel <?php if ($now->diff($date)->format("%m") < 3) { echo 'panel-red'; } else if ($now->diff($date)->format("%m") < 6) { echo 'p
×
×
  • 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.