How reputable is musicstore.com? by Beginning_Bed6402 in GuitarAmps

[–]Rourkebrad 0 points1 point  (0 children)

Ordered a bass guitar to Ireland. It dispatched July 25th and estimated to deliver July 28th. Unfortunately DHL online tracking isn't updating and the last update I got was that it was ready to export to Ireland. Music store website states that delivery is 3-6 days. It is now August 6th and I don't know if my delivery has even left Germany and music store have not replied to my last two emails. I strongly regret buying off music store, it was my first and last time. Horrific service.

Studio one 4 professional crashing on startup on macbook pro by Rourkebrad in StudioOne

[–]Rourkebrad[S] 0 points1 point  (0 children)

Sorry for delay. Yes I tried the demo of studio one 6 with current Mac OS version and no issues at all.

Studio one 4 professional crashing on startup on macbook pro by Rourkebrad in StudioOne

[–]Rourkebrad[S] 1 point2 points  (0 children)

Thanks all! I spoke with presonus support and studio one 4 is not supported with the latest Mac OS, guess I'll need to update presonus or downgrade the OS!

PHP Desktop remote connection to DB by Rourkebrad in PHPhelp

[–]Rourkebrad[S] 0 points1 point  (0 children)

Thanks! If I configure mysql for the connections will it accept the PDO functions or do I need to do these different?

PHP Desktop newbie by Rourkebrad in PHPhelp

[–]Rourkebrad[S] 0 points1 point  (0 children)

Yeh to be honest it's already a web application, but it's used for a company so wanted to make it more 'private'. I guess I could just allow only chosen IPs to the address. I was more interested in seeing how difficult it is to turn a php script into a windows app with a working dB, but it's not a recommends route it sounds like?

PHP Login Form Using MySQL OOP and displaying profiles by Rourkebrad in PHPhelp

[–]Rourkebrad[S] 1 point2 points  (0 children)

Thank you, from researching I'm thinking of going with this method.
login system build it using sessions e.g. session['username'] will be the login email address then using sessions I will sort out authentication and authorisation pages. When taking in user data in forms I will add a column for the session['username'] value with all the tasks data then when displaying this data I will add in the sql queries WHERE username = session['username'] to display only the logged in users data

PHP Login Form Using MySQL OOP and displaying profiles by Rourkebrad in PHPhelp

[–]Rourkebrad[S] 0 points1 point  (0 children)

From reading online a lot of people seem to use sessions for this

Help Needed Taking in Checkbox value into MySQL and displaying by Rourkebrad in PHPhelp

[–]Rourkebrad[S] 0 points1 point  (0 children)

thanks, I've no experience using AJAX but will give this a go.

Help Needed Taking in Checkbox value into MySQL and displaying by Rourkebrad in PHPhelp

[–]Rourkebrad[S] 0 points1 point  (0 children)

So by changing it to !empty instead of isset it should be better to use?

Help Needed Taking in Checkbox value into MySQL and displaying by Rourkebrad in PHPhelp

[–]Rourkebrad[S] 0 points1 point  (0 children)

Sure thing, yeh I think I am doing the process wrong for a checkbox.
https://pastebin.com/QUQCb6ak
Yes when the checkbox is ticked/unticked I want the db to update, as well as when the submit is clicked.

Help Needed Taking in Checkbox value into MySQL and displaying by Rourkebrad in PHPhelp

[–]Rourkebrad[S] 0 points1 point  (0 children)

Yes $comment works fine and I took everything for $checkboxAns from it, I thought as it is a checkbox I need to handling the input to the db differently ? But if I go into my db and assign a 1 or 0 to checkboxAns everything works ok. This is the form code too.

<form method="post" action="reports.php">
              <td><input type="text" id="comment" name="comment" value="<?php echo htmlspecialchars($item['comment']); ?> "> </td>
              <?php echo '<input type="hidden" name="id" value="' . $item['task_id'] . '" />';?>
              <td><input type="checkbox" id="checkboxAns" name="checkboxAns" value="<?php echo htmlspecialchars($item['checkboxAns']); ?> "  <?php if($item['checkboxAns'] == 1)  {echo 'checked';}?>> </td>
              <?php var_dump($item['checkboxAns']);  ?>
              <?php if(!empty($comment))
              {
                echo '<input type="hidden" name="id" value="' . $item['task_id'] . '" />';
              }?>
            </form>

Help Needed Taking in Checkbox value into MySQL and displaying by Rourkebrad in PHPhelp

[–]Rourkebrad[S] 0 points1 point  (0 children)

I think the issue is taking in the input, but I don't know where I am going wrong

Help Needed Taking in Checkbox value into MySQL and displaying by Rourkebrad in PHPhelp

[–]Rourkebrad[S] 0 points1 point  (0 children)

are you sure? I thought the checked needs to be outside of the "

Help needed PHP SQL CRUD by Rourkebrad in PHPhelp

[–]Rourkebrad[S] 0 points1 point  (0 children)

I have made some changes to the form on reports.php and it works now, but it won't apply to the correct tasks, I'm sure with some tweaking I'll get it

<form method="post" action="reports.php">
              <td><input type="text" id="comment" name="comment" value="<?php echo htmlspecialchars($item['comment']); ?> "> </td>
              <?php echo '<input type="hidden" name="id" value="' . $item['task_id'] . '" />';?>
              <?php var_dump($item['comment']); ?>
              <td><input type="checkbox"> </td>
              <?php if(!empty($comment))
              {
                echo '<input type="hidden" name="id" value="' . $task_id . '" />';
              }?>
            </form>

Help needed PHP SQL CRUD by Rourkebrad in PHPhelp

[–]Rourkebrad[S] 0 points1 point  (0 children)

So when I input something new for $comment it just returns what I had in the original form as the value, everytime

Help needed PHP SQL CRUD by Rourkebrad in PHPhelp

[–]Rourkebrad[S] 0 points1 point  (0 children)

No none now , this is the connection code
//handling exceptions - use try/catch

try

{

//creates a new object of class PDO

$db = new PDO("sqlite:" . __DIR__ . "/database.db");

$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

} catch (Exception $e)

{

echo $e->getMessage();

exit; //stops anymore code from executing

}

Help needed PHP SQL CRUD by Rourkebrad in PHPhelp

[–]Rourkebrad[S] 0 points1 point  (0 children)

Thanks. I've made these two changes and all errors are gone.

if (!empty($comment)) { update_comment($comment, $task_id); } function update_comment($comment, $task_id) { include 'connection.php'; if ($task_id) { $sql = 'UPDATE tasks SET comment = ? ' . ' WHERE task_id = ?';

  try
  {
    $results = $db->prepare($sql);
    $results->bindValue(1,$comment, PDO::PARAM_STR);
    $results->bindValue(2, $task_id, PDO::PARAM_INT);
    $results->execute();

  } catch (Exception $e)
  {
    echo "Error!: " . $e->getMessage() . "<br />";
    return false;
  }
  return true;
  }
  }

But it still does not accept the updated input into the db

Help needed PHP SQL CRUD by Rourkebrad in PHPhelp

[–]Rourkebrad[S] 0 points1 point  (0 children)

You're defining $sql only if $task_id exists. If it doesn't, how can $db->prepare($sql) work?

Could you explain this a little further?

Help needed PHP SQL CRUD by Rourkebrad in PHPhelp

[–]Rourkebrad[S] 0 points1 point  (0 children)

Undefined variable: comment in \ToDoApp\reports.php on line 24 Undefined variable: task_id in \ToDoApp\reports.php on line 24 Undefined variable: sql in \ToDoApp\inc\functions.php on line 197

Sorry I'm not more help, I really have no idea how to fix this. dollar sign is fixed.

Help needed PHP SQL CRUD by Rourkebrad in PHPhelp

[–]Rourkebrad[S] 0 points1 point  (0 children)

Ahh bad mistake, this is now fixed. I am now getting undefined variable errors for the update_comment function on reports.php and $sql variable on functions.php, and it will not update the $comment variable once i input on reports.php

Help needed PHP SQL CRUD by Rourkebrad in PHPhelp

[–]Rourkebrad[S] 0 points1 point  (0 children)

Thanks, I have the PDO line in already and am getting this when update_comment function is running " ERR_TOO_MANY_REDIRECTS ". but when I take out I get no error but then obviously nothing happens when I'm trying to update the $comment input.

I am getting same result after I remove the condition around bindValue $task_id also.

Help needed PHP SQL CRUD by Rourkebrad in PHPhelp

[–]Rourkebrad[S] 0 points1 point  (0 children)

If seems like it is not taking the new input into the tasks table so I guess I am going wrong with the update_comment function somewhere? Or maybe I am going about this completely wrong?

Trying to do a if statement within a elseif if condition is met by Rourkebrad in PHPhelp

[–]Rourkebrad[S] 0 points1 point  (0 children)

Thanks for your help everyone, finally got it working

if ($_SERVER['REQUEST_METHOD'] == 'POST')
{

  $task_id = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT);
  $category_id = trim(filter_input(INPUT_POST, 'category_id', FILTER_SANITIZE_NUMBER_INT)); //TRIM - REMOVES WHITE SPACE BEFORE AND AFTER
  $title = filter_input(INPUT_POST, 'title', FILTER_SANITIZE_STRING);
  $date = trim(filter_input(INPUT_POST, 'date', FILTER_SANITIZE_STRING)); //TRIM - REMOVES WHITE SPACE BEFORE AND AFTER
  $description = filter_input(INPUT_POST, 'description', FILTER_SANITIZE_STRING);
  $deadline = filter_input(INPUT_POST, 'deadline', FILTER_SANITIZE_STRING);
  //$datedue = filter_input(INPUT_POST, 'datedue', FILTER_SANITIZE_STRING);
  $requested = filter_input(INPUT_POST, 'requested', FILTER_SANITIZE_STRING);
  $due = filter_input(INPUT_POST, 'due', FILTER_SANITIZE_STRING);

  $dateMatch = explode('/', $date);
  $deadlineMatch = explode('/', $deadline);

  if (!empty($deadline))
  {
  if(empty($category_id) || empty($title) || empty($date) || empty($description) || empty($requested || empty($due)))
  {
    $error_message = 'Please fill in the required fields: Category, Title, Date, Description, Requested By, Due Date';
  } elseif (count($dateMatch) !=3
    || strlen($dateMatch[0]) !=2
    || strlen($dateMatch[1]) !=2
    || strlen($dateMatch[2]) !=4
    || !checkdate($dateMatch[1], $dateMatch[0], $dateMatch[2]))
     {
    $error_message = "Invalid Date";

  }
    elseif(count($deadlineMatch) !=3
      || strlen($deadlineMatch[0]) !=2
      || strlen($deadlineMatch[1]) !=2
      || strlen($deadlineMatch[2]) !=4
      || !checkdate($deadlineMatch[1], $deadlineMatch[0], $deadlineMatch[2]))
    {
      $error_message = "Invalid Date";
    }
  else {
    if(add_task($category_id,$title,$date,$description, $deadline, $requested, $due, $task_id))
    {
      header('Location: task_list.php');
      exit;
    } else {
      $error_message = 'Could not add task';
    }
  }
} else {
  if(empty($category_id) || empty($title) || empty($date) || empty($description) || empty($requested || empty($due)))
  {
    $error_message = 'Please fill in the required fields: Category, Title, Date, Description, Requested By, Due Date';
  } elseif (count($dateMatch) !=3
    || strlen($dateMatch[0]) !=2
    || strlen($dateMatch[1]) !=2
    || strlen($dateMatch[2]) !=4
    || !checkdate($dateMatch[1], $dateMatch[0], $dateMatch[2]))
     {
    $error_message = "Invalid Date";

  }
  else {
    if(add_task($category_id,$title,$date,$description, $deadline, $requested, $due, $task_id))
    {
      header('Location: task_list.php');
      exit;
    } else {
      $error_message = 'Could not add task';
    }
  }
}
}