Jump to content

JamesB

Members
  • Posts

    425
  • Joined

  • Last visited

Everything posted by JamesB

  1. Can you show all of the latest code that you have, including the call to get_appointments()
  2. If apID is fetched in both queries then the arrays can be linked on this value. while ($appdetails = $result->fetch_object()){$details = array('name' => $appdetails->name,'apID'=>$appdetails->apID,'start'=>$appdetails->startDate,'end'=>$appdetails->endDate,'staffID'=>$appdetails->staffID,'origin'=>$appdetails->apps_origin);$appdata[$appdetails->apID] = $details;}while($service = $result1->fetch_object()){ // make sure to fetch 'apID' field in this query$appdata[$service->apID]['service'][] = $service->serviceID;}
  3. How does the services query data relate to the first query data? Is there a field in both of the 2 queries that retrieves the same value?
  4. In your css, add: h2{clear: left;}
  5. $salt = 'example'; // this must never change $passwordUnencrypted = 'password';$passwordEncrypted = hash('sha512', $passwordUnencrypted . $salt); // adding row to table (registering)$sql = "INSERT INTO users (password) VALUES ('" . $passwordEncrypted ."')"; // checking password in table (logging in)$sql = "SELECT COUNT(*) FROM users WHERE password = '" . ($passwordEncrypted) ."' LIMIT 1"; // obviously check for username too // updating password in table (changing password)$sql = "UPDATE users SET password = '" . $encryptedPassword . "' WHERE user_id = " . $user_id;
  6. Your var_dump is a 2 dimensional array, my example is a 3 dimensional array. But if you are using a 2 dimensional array, this should work: $event[$i] = array('id'=>$appdata["apID"],'title' => $appdata["name"],'staff_ID'=>$appdata['staffID'],'start' =>$appdata['start'],'end'=>$appdata['end'],'color'=>$backend,'allDay'=>false,'services' => $appdata['service']);
  7. Well inside the get_appointments() function I can understand $appdata being a 1 dimensional array and (2 dimensional array for services key), but outside that function isn't $appdata supposed to be 2 dimensional (and 3 dimensional for services key)? Because you have $appdata[$i]["apID"] instead of $appdata["apID"]. Outside the get_appointments() function, shouldn't the $appdata array look like this: Array( [0] => Array( [name] => Kostas [apID] => 16 [start] => 2014-08-27 12:30:00 [end] => 2014-08-27 15:00:00 [staffID] => 5 [origin] => backend [service] => Array ( [0] => 1 [1] => 2 )))
  8. Can you show a print_r() of your $appdata array on the line before this one: $event[$i] = array('id'=>$appdata[$i]["apID"],
  9. Would this be suitable? $event[$i] = array('id'=>$appdata[$i]["apID"],'title' => $appdata[$i]["name"],'staff_ID'=>$appdata[$i]['staffID'],'start' =>$appdata[$i]['start'],'end'=>$appdata[$i]['end'],'color'=>$backend,'allDay'=>false,'services' => $appdata[$i]['service']); // <------
  10. JamesB

    different heights

    Seems to work if you remove the 2<br> elements after the </div>.
  11. Is mystye.css in the same folder as the .html file which has that code? That code should work in Opera.
  12. to make the 'service' key an array, change $details['service'] = $service->serviceID; to $details['service'][] = $service->serviceID;
  13. Or infact if you are after a 3 dimensional array: $index = 0;while($service = $result1->fetch_object()){$names[$index]['services'][] = $service->serviceID;$index++;}
  14. if both result objects contain the same amount of rows and each row relates to the other with the same row index, you could use this: $index = 0;while($service = $result1->fetch_object()){$names[$index]['service'] =$service->serviceID;$index++;}
  15. If you want to submit a form when a <select> changes, i'm almost certain you need to use JavaScript.
  16. You can't call a PHP function from JavaScript code directly. html and javascript runs on the client-side. (in web browsers) php runs on the server-side. If you want client-side code to call server-side code, eg. the javascript code onchange="ChangePriority()" to call your PHP ChangePriority() function, then communication needs to happen between the client and the server. One way for them to communicate on the web is by submitting a form. So you can make the JavaScript code submit the form when the select changes, like in my previous post, then in your PHP page you can check if the form was submitted, and fetch the value with $_POST['Priority'], then you can call the PHP function ChangePriority().
  17. <select onchange="submitTheForm()"><select><form id='theForm'></form> function submitTheForm(){var form = document.getElementById('theForm');form.submit();}
  18. You seem to be breaking out of the loop, meaning score will be a max of 1 per call to checkResults(), assuming you reset score to 0. You are also only fetching the text input value once, which should be happening for each question in the loop. function checkResults() {score = 0;for (var k in answers) {var$this = $('#'+k),val = $this.val().toLowerCase();if (answers.hasOwnProperty(k)) {if (answers[k] === val) {$this.css('background-color', 'green');score++;} else {$this.css('background-color', 'red');}}}if (score == 2) {alert('Hi Ur Score is 2');}$('#score').text('score: ' + score);}
  19. First language i learnt was mIRC. First programming language I learnt was c++.
  20. Check the following settings in your php.ini file or with ini_get() http://php.net/manual/en/function.ini-get.php upload_max_filesize post_max_size As the file size could be exceeding these.
  21. Is your mysql query code supposed to be in the for loop?
  22. Can you show us your code?
  23. prompt('Access Denied - Sorry you don't have access to this page','Password'); You need to escape the apostrophe in the word "don't".
  24. The required attribute is client-side validation and is only for convenience, it should not be relied upon for validation. You should be validating that all fields aren't blank server-side in PHP.
  25. not sure if this will work, but worth a shot. SELECT RcptNo, Discount, ProductCode, ((SELECT SUM(Price) FROM table WHERE RcptNo = 111) - Discount) as TotalPrice FROM table WHERE RcptNo = 111
×
×
  • Create New...