-
Posts
24,563 -
Joined
-
Last visited
-
Days Won
822
Everything posted by Barand
-
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
-
How to Validate 2 Columns do Not Match Over 20 Rows
Barand replied to evenmonkeys's topic in MySQL Help
how are you storing the data? -
Simple INSERT Script Fails - No Error Message
Barand replied to spock9458's topic in PHP Coding Help
try this link http://www.phpfreaks.com/tutorial/data-joins-unions -
Simple INSERT Script Fails - No Error Message
Barand replied to spock9458's topic in PHP Coding Help
Use SQL JOINS http://forums.phpfreaks.com/page/tutorials/_/data-joins-unions -
Simple INSERT Script Fails - No Error Message
Barand replied to spock9458's topic in PHP Coding Help
Normalize you data (for the third time). Don't just store spreadsheets in MySQL tables. -
The methods you're calling would be a start
-
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.
-
Store in an array while ....... { $mailarray[] = $row['email']; }
-
my mysql query optimization,execute query fast
Barand replied to Kamlesh_Rathore's topic in MySQL Help
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 -
Combining 3 output from 3 queries in mysql and do some calculations
Barand replied to mikeyoung's topic in MySQL Help
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 | +----------+ -
Help with code. query does not work inside a function?
Barand replied to r2get's topic in PHP Coding Help
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 -
How about WHERE (indentity_number = $x) OR (student_code = '$y')
-
Good thinking, I hadn't considered "00000000001230".
-
couple of ways $a = '00000000000123'; $n = intval($a); echo $n; // 123 $n = trim($a, '0'); echo $n; // 123
-
http://lmgtfy.com/?q=php+mysql+pagination+tutorial
-
do you have error reporting turned on?
-
You have a pair of {} missing in the final else statement
-
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";
-
For the benefit of the non-clairvoyant ones out here, what's your current code for creating the session variables?
-
Array row count is right, but can't see values
Barand replied to mattward's topic in PHP Coding Help
I'm using windows and it certainly wouldn't have worked on mine. Were you using mysqli on the WAMP server? -
Array row count is right, but can't see values
Barand replied to mattward's topic in PHP Coding Help
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 -
How Can i Make a Conditon to get two diffrent Percentage
Barand replied to allpkresults's topic in PHP Coding Help
Give us more and we can give you more -
Array row count is right, but can't see values
Barand replied to mattward's topic in PHP Coding Help
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. -
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