Jump to content

Barand

Moderators
  • Posts

    24,563
  • Joined

  • Last visited

  • Days Won

    822

Everything posted by Barand

  1. Don't use code that was deprecated 10 years ago. http://php.net/manual/en/features.file-upload.php
  2. Or maybe it's to do with your writing all values to the same array key instead of appending to the array as my code would
  3. how are you storing the data?
  4. try this link http://www.phpfreaks.com/tutorial/data-joins-unions
  5. Use SQL JOINS http://forums.phpfreaks.com/page/tutorials/_/data-joins-unions
  6. Normalize you data (for the third time). Don't just store spreadsheets in MySQL tables.
  7. The methods you're calling would be a start
  8. xxhK, Tips for future posts: 1. Give posts a descriptive title, not just "Please help me". These forums are used by people searching for similar problems. 2. Use lower case - don't shout. 3. Use the <> button or code tags around your code.
  9. Store in an array while ....... { $mailarray[] = $row['email']; }
  10. Does this help SELECT t.train_no, t.train_name FROM trains t INNER JOIN train_schedule AS s1 ON t.train_no = s1.train_no AND s1.stn_code = 'JU' INNER JOIN train_schedule AS s2 ON t.train_no = s2.train_no AND s2.stn_code = 'JP' WHERE s1.distance < s2.distance ORDER BY train_no LIMIT 0 , 30 If not, can you post a test dump of the two tables
  11. Whey the second table? You could have put the userid as a column in the first table> try SELECT ROUND(SUM(incorrect/answered)/COUNT(*), 3) as result FROM ( SELECT qa.questionid, SUM(IF(qa.rightanswer <> qa.responsesummary, 1, 0)) as incorrect , COUNT(*) as answered FROM mdl_question_attempts qa INNER JOIN mdl_question_attempt_steps qas ON qa.id = qas.questionattemptid WHERE qas.userid = $user GROUP BY qa.questionid HAVING incorrect > 1 ) as totals OUTPUT: +----------+ | result | +----------+ | 0.583 | +----------+
  12. It's a question of variable scope. Your $db_connect variable is no available inside the function, you need to pass it to the function as a an argument when you call the function. http://php.net/manual/en/language.variables.scope.php
  13. How about WHERE (indentity_number = $x) OR (student_code = '$y')
  14. Good thinking, I hadn't considered "00000000001230".
  15. couple of ways $a = '00000000000123'; $n = intval($a); echo $n; // 123 $n = trim($a, '0'); echo $n; // 123
  16. http://lmgtfy.com/?q=php+mysql+pagination+tutorial
  17. do you have error reporting turned on?
  18. You have a pair of {} missing in the final else statement
  19. It would look like this $whereclause = ''; $where = array(); if(strlen($_POST['city'])>0){ $city = mysql_real_escape_string($_POST['city']); $where[] = "city = '$city'"; } if(strlen($_POST['country'])>0){ $country = mysql_real_escape_string($_POST['country']); $where[] = "country = '$country'"; } if(strlen($_POST['occurence'])>0){ $occurence = mysql_real_escape_string($_POST['occurence']); $where[] = "occurence = '$occurence'"; } if (count($where) > 0) { $whereclause = "WHERE " . join(' AND ', $where); } $sql = "SELECT * FROM social $whereclause";
  20. For the benefit of the non-clairvoyant ones out here, what's your current code for creating the session variables?
  21. I'm using windows and it certainly wouldn't have worked on mine. Were you using mysqli on the WAMP server?
  22. The foreach didn't work because $result (as shown by the print_r() ) was not an array of row data, it was a mysqli result object
  23. Give us more and we can give you more
  24. I don't see any rows of data in there, do you? try while ($row = $result->fetch_assoc()) { echo "<option value=" . $row['SectionID'] . ">" . $row['SectionName'] . "</option>"; } I must confess to being puzzled about it working previously.
  25. The while statement will loop until $x has a value of 6. Because of the post-increment it will then be incremented to 7 after the value test. The result will therefore be 7 is output
×
×
  • 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.