-
Posts
14 -
Joined
-
Last visited
Never
Everything posted by tipsmail7
-
Maybe you can change the formula in the 3rd line to $rounded = (round($time / $round / 60)) * $round * 60;
-
So, could you elaborate what's the "wrong" means? PS: Are you intend to update ALL row? (because you have no "WHERE" in 2nd query)
-
problem in where clause to check if the date is exist in another table
tipsmail7 replied to newphpcoder's topic in MySQL Help
This error caused by the subquery SELECT DATE(LOGOUT) FROM reg_att r WHERE r.EMP_NO = n.EMP_NO wasn't returns unique row as suggested in http://stackoverflow.com/questions/2419094/help-with-subquery-returns-more-than-1-row maybe you could replace '=' with IN SELECT n.EMP_NO, n.TIME_IN, n.TIME_OUT, TOTAL_HOURS, NRS_STATUS FROM nrs n WHERE EMP_NO = '00000221' AND DATE(TIME_OUT) = '2012-03-01' OR DATE(TIME_OUT) IN (SELECT DATE(LOGOUT) FROM reg_att r WHERE r.EMP_NO = n.EMP_NO); -
You could use array and $_GET from PHP to accomplish your goal <?php //how many image per page? $img_per_page = 20; //default page $page = 1; //sanitize GET var if ((isset($_GET["page"])) && (is_int($_GET["page"]))) $page = $_GET["page"]; //Your folder $files = glob("images/*.*"); //max page possible $max_page = ceil(count($files) / $img_per_page); if ($page > $max_page) { echo "there is no page"; //or other warning } else { function sortnewestfilesfirst($a, $b) { //the rest of your code..... echo '</table>'; //add pagination for ($x = 1; $x <= $max_page; $x++) { echo "<a href='yourpage.php?page=$x'>[ $x ] </a>"; } } reference: http://www.w3schools.com/php/php_get.asp
-
Iterate that array in first level (Continent) Then, you could use implode function in PHP to concatenate array to string foreach ($arr as $continent => $countries) { $val = implode(", ", $countries); // $val = 'China, Japan' $sql = "UPDATE table_name SET Country='$val' WHERE Continent='$continent'"; }
-
Crap! I just don't get it. Well, I 'run' that form in my web server, and it produces an expected mail, e.g., it writes Best time to call: Evening not Best time to call: Array. So why your email-result is not same as my email-result? *sorry if you don't understand my English. Or maybe I just don't understand your question?
-
It's strange When I copy that code and try it my apache, the email body was expected (not an 'Array' word) result in my email: ============================== Subject: Info request from Interface Financial Group on Buzgate X-PHP-Originating-Script: 0:form-test.php From: [email protected] Country: Antarctica Best time to call: Evening ==============================
-
when you use single quote (like <?php echo '$matchid'; ?>), so the output will be $matchid, not the value of the $matchid variable You could use double quote (") or concatenate the string with this success($mes,'./ffamatches.php?id=' . $matchid); reference: http://www.trans4mind.com/personal_development/phpTutorial/quotes.htm
-
PHP insert in MySQL database table in random order?
tipsmail7 replied to Metasearching's topic in PHP Coding Help
In addition, if you will to randomize it in mysql-raw-data, you could query "ALTER TABLE emailtable ORDER BY columnid" every new email inserted to table (the columnid contains random id as suggested by KevinM1) But, it may impact performance if it is a big table -
maybe your query was wrong so the return from function mysql_query() was "FALSE" (boolean type) http://www.php.net/manual/en/function.mysql-query.php http://php.net/manual/en/function.mysql-fetch-assoc.php
-
Problem in computation of late hours(disregard the seconds)
tipsmail7 replied to newphpcoder's topic in MySQL Help
Ah my bad. Instead using FLOOR, we could use CEIL SEC_TO_TIME ( CEIL (( TIME_TO_SEC ( time1) - TIME_TO_SEC ( time2) ) / 60) * 60) -
From your question, maybe this answer that you looking for [cut] $sum = 0; // dummy variable to calc total score for ( $i = 0; $i < $num_scores; $i++ ) { $HTML .= '<tr>' . "\n"; $HTML .= ' <td class="player">' . str_format( $scores[$i]['name'] ) . '</td>' . "\n"; $HTML .= ' <td class="player">' . $scores[$i]['points'] . '</td>' . "\n"; $HTML .= '</tr>' . "\n"; $sum += $scores[$i]['points']; //every loop, add the current score to dummy variable } $HTML .= '</tbody>' . "\n"; $HTML .= '<tfoot>' . "\n"; $HTML .= '<tr>' . "\n"; $HTML .= ' <th colspan="2">' . $sum . '</th>' . "\n"; //output the result [cut].....
-
Problem in computation of late hours(disregard the seconds)
tipsmail7 replied to newphpcoder's topic in MySQL Help
hmmm, its strange As far as i know your trouble lies in this code sec_to_time(time_to_sec('08:00:00') - time_to_sec(Rendered)) so i suggest you to only change that line when I try it myself SELECT SEC_TO_TIME( ( FLOOR( ( TIME_TO_SEC( '08:00:00' ) - TIME_TO_SEC( '07:58:41' ) ) /60 ) +1 ) *60 ) the result: 00:02:00 -
Problem in computation of late hours(disregard the seconds)
tipsmail7 replied to newphpcoder's topic in MySQL Help
a bit ugly solution inspired from http://stackoverflow.com/questions/5764560/how-do-i-round-a-mysql-time-to-the-nearest-hour-not-a-date-time-timestamp Step by step calculate the difference in seconds unit divide it with 60 (so we have the difference in minutes unit) FLOOR it (take it to nearest integer) add with 1 multiply by 60 (to return it in seconds unit) so the query will be: SEC_TO_TIME( ( FLOOR( ( TIME_TO_SEC( '08:00:00' ) - TIME_TO_SEC(Rendered) ) / 60 ) + 1 ) *60 ) -
Hello everyone tipsmail7 -> still beginner to learn this awesome language PHP Nice to meet you in this forum