Jump to content

Moorcam

Members
  • Posts

    155
  • Joined

  • Last visited

About Moorcam

  • Birthday 02/12/1971

Profile Information

  • Gender
    Male
  • Location
    Victoria, Australia
  • Age
    50

Recent Profile Visitors

1,789 profile views

Moorcam's Achievements

Advanced Member

Advanced Member (4/5)

3

Reputation

3

Community Answers

  1. Been here a while and can't remember posting anything in here so thought I had better. Anyways, I am Dan. 50 years old. Anyone who says that life begins at 40 and 50 is the new 21 has no idea. I am Irish. Grew up in a lovely market town in the South East called Dungarvan. Loved it there. I now live in Central Victoria, Australia and have done for almost 14 years. I guess my coding and dev days started many centuries ago. My first taste of any type of development was in school on an old Apple computer where the class created a messaging type thing that only sent messages from one computer to the other. It was absolute shite but at 14 years of age we thought it was amazing. From there I took an interest in website design and hosting and ran a successful VPS Hosting service in Ireland for a number of years while designing websites on the side for clients. I sold that business in 2005 and drank more Guinness than the Brewery could brew and gave up on the whole shebang until about 2+ years ago. Wow, how the coding standards have changed. I am now back to Square One, learning about PHP, JavaScript and this PDO and Bootstrap carry on. 🤔 At the moment I drive Interstate on a regular basis, mostly in Road Coaches and Semi Trucks on an odd occasion. Love it, but want to settle at home. So, myself and an ex- employer of mine are currently working on an application that we hope will allow me to do just that as there is a huge opening in the Market for an app like it here in Australia. Enough said Anyways, pleasure to make your acquaintance.
  2. Is it worth the price though? What does it offer that say, Sublime Text or Visual Studio Code doesn't? Asking for a friend I used Notepad++ for years and recently started to use Sublime Text.
  3. Thought I would add to the list. Been using VentraIP Australia with years. Also used to work for them and still great friends with the owners. Top quality services. http://www.ventraip.com.au
  4. Howdy, Just started to use PDO and loving it so far. Much better than MySQLi. Anyway, would like to know the best reference books available for PHP. If you use reference books, what do you use? Had a google today and found one "The Complete Reference to PHP". Sounded promising but was published in 2007 so not sure if it would be a good buy. Thoughts?
  5. Moorcam

    Video script

    As requinix said, you will need to learn about the workings of CSS and HTML and how they both work together. My advice is to make use of the website w3schools.com and learn these two vital languages. For this to do what you want, wouldn't be surprised if you needed some Javascript too. Post up your HTML with the video in a simple iFrame and playable. Maybe someone here can point you in the right direction.
  6. Not sure if this is what you were looking for but it's what I used when I used MySQLi to upload an image: $image = mysqli_real_escape_string($con, $_FILES['image']['name']); // image file directory $target = "images/".basename($image); if(!empty($_FILES['image']['name'])) { $sql = "UPDATE table SET image='".$image."'"; } $result = mysqli_query($con, $sql); if (move_uploaded_file($_FILES['image']['tmp_name'], $target)) { $msg = "Image uploaded successfully"; }else{ $msg = "Failed to upload image"; } if(!$result){ die('Error: ' . mysqli_error($con)); } else{ $message = ' - <i class="fa fa-check text-success"> Record Updated!</i>'; } } } I know it's not an INSERT but the image upload script should still work. Sorry if this is not what you are looking for. BTW: go to PDO. It's more fun.
  7. Thank you so much man. Really appreciate it. Promise I won't bother you anymore ... until the next issue
  8. Thanks heaps. Now, if there is a scenario where the form needs to be updated but without uploading a new image, at this time it just gets rid of the current image. I need to work out how to prevent that. Previously, before moving to PDO, I had a second insert query inside an if clause. Tried it with this but got an UNEXPECTED else.
  9. Had the sandwich and the coffee. No smoke because I gave them up about 2 weeks ago (God help everyone around me) and had a look at the first line. Changed it to the following: if(!empty($_FILES['image']['name'])) { Works perfectly. No idea why that didn't shout at me earlier. Thank you kindly.
  10. Hi guys, Using the following code to upload an image to a directory. It aint being funky... if ($_FILES['image']['error'] = UPLOAD_ERR_OK) { // image file directory $target = "images/uploads/".basename($_FILES['image']['name']); if (move_uploaded_file($_FILES['image']['tmp_name'], $target)) { $msg = "Image uploaded successfully"; $post['image'] = $target; }else{ $msg = "Failed to upload image"; $post['image'] = null; } } else { $post['image'] = null; } Can anyone tell me what's up? Thanks guys
  11. Thanks mate. Will do. Bit of a massive learning curve but no doubt I will get there. Thanks for your help guys.
  12. Just saw this now. Thanks heaps mate. It works. I will get there eventually
  13. Ok, I am having a crack here so please be gentle. include_once('includes/header.php'); if(isset($_POST['submit'])){ $id = trim($_SESSION['id']); //$trn_date = trim($db, date("Y-m-d H:i:s")); //$password = $db->real_escape_string(md5($_POST['password'])); $image = trim($_FILES['image']['name']); $name = trim($_POST['name']); $phone = trim($_POST['phone']); $email = trim($_POST['email']); $address = trim($_POST['address']); $license_number = trim($_POST['license_number']); $position = trim($_POST['position']); $role = trim($_POST['role']); $submittedby = trim($_SESSION["username"]); // image file directory $target = "images/".basename($image); if(!empty($_FILES['image']['name'])) { $stmt = $db->prepare("UPDATE users SET name = ?, email = ?, phone = ?, address = ?, license_number = ?, position = ?, role = ?, submittedby = ?, image = ? WHERE id = ?"); if (move_uploaded_file($_FILES['image']['tmp_name'], $target)) { $msg = "Image uploaded successfully"; }else{ $msg = "Failed to upload image"; } }else{ $stmt = $db->prepare("UPDATE users SET name = ?, email = ?, phone = ?, address = ?, license_number = ?, position = ?, role = ?, submittedby = ? WHERE id = ?"); } $stmt = $db->execute(array($name, $email, $phone, $address, $license_number, $position, $role, $submittedby, $image)); if($stmt->execute()){ echo 'Done'; }else{ echo 'Not Done'; } } The above gives an error: Fatal error: Uncaught Error: Call to undefined method PDO::execute() That's this line: $stmt = $db->execute(array($name, $email, $phone, $address, $license_number, $position, $role, $submittedby, $image)); I am at a complete roadblock here.
  14. Howdy folks, I have decided, after a discussion with Barand, to finally hang up the MySQLi shoes and move over to the dark side of PDO. I am trying to Update a profile, for example, but it is not working. No errors or anything. New to PDO so would love some help on figuring out where I am going wrong. Probably everywhere knowing me lol. Here is the dreaded code: if(isset($_POST['submit'])){ $id = trim($_SESSION['id']); //$trn_date = trim($db, date("Y-m-d H:i:s")); //$password = $db->real_escape_string(md5($_POST['password'])); $image = trim($_FILES['image']['name']); $name = trim($_POST['name']); $phone = trim($_POST['phone']); $email = trim($_POST['email']); $address = trim($_POST['address']); $license_number = trim($_POST['license_number']); $position = trim($_POST['position']); $role = trim($_POST['role']); $submittedby = trim($_SESSION["username"]); // image file directory $target = "images/".basename($image); if(!empty($_FILES['image']['name'])) { $sql = "UPDATE users SET name = :name, email = :email, phone = :phone, address = :address, license_number = :license_number, position = :position, role = :role, submittedby = :submittedby, image = :image"; }else{ $sql = "UPDATE users SET name = :name, email = :email, phone = :phone, address = :address, license_number = :license_number, position = :position, role = :role, submittedby = :submittedby"; } $stmt= $db->prepare($sql); if (move_uploaded_file($_FILES['image']['tmp_name'], $target)) { $msg = "Image uploaded successfully"; }else{ $msg = "Failed to upload image"; } if(!$stmt){ if ($stmt->execute()){ $message = ' <i class="fa fa-check text-danger"> Something went wrong please contact the server admin.</i>'; } else{ $message = ' <i class="fa fa-check text-success"> Record Updated!</i>'; } } } Any help folks would be appreciated
  15. Working. Mate you are a legend. $sql = "INSERT INTO timesheets (user_id, week_ending, timesheet_comment) VALUES ('$user_id', '$week_ending', '$timesheet_comment')"; if (mysqli_multi_query($con, $sql)) { $last_id = $con->insert_id; } $sql2 = "INSERT INTO stafftime (sheet_id, staff_date, time_start, time_end, break_time) VALUES ('$last_id', '$staff_date', '$time_start', '$time_end', '$break_time')"; if (mysqli_multi_query($con, $sql2)) { $message = '<p class="text-success"><i class="fa fa-check"></i> - Timesheet Submitted Successfully</p>'; } else { $message = '<p class="text-danger"><i class="fa fa-check"> Error:'. $sql2 . '<br>' . mysqli_error($con).'</p>'; } mysqli_close($con); }
×
×
  • 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.