-
Posts
24,566 -
Joined
-
Last visited
-
Days Won
822
Everything posted by Barand
-
SET colname1 = :value1, colname2=:value2, .....
-
Turn error reporting on then the reason becomes obvious. $media->group->content doesn't exist for the third item
-
You need to use find records where col1 or col2 is equal to the least number WHERE (SELECT LEAST(MIN(COL1),MIN(COL2))FROM yourtable) IN (COL1, COL2)
-
Set up the array structure that you need for your chart data then process your input, accumulating the data for each hour // // INPUT DATA // $input = [ ['0900', '2000', 1, 5], ['1000', '2200', 1, 3] ]; // // PREPARE ARRAYS TO STORE CHART DATA // $init = array_fill_keys(range(0,23), 0); $data = [ 0 => ['name'=>'Supervisors', 'data'=>$init ], 1 => ['name'=>'Staff', 'data'=>$init ] ]; // // PROCESS THE INPUT // foreach ($input as $row) { list($start, $end, $sup, $staff) = $row; for ($hr=$start/100; $hr<$end/100; $hr++) { $data[0]['data'][$hr]+=$sup; $data[1]['data'][$hr]+=$staff; } } // // CHECK CHART DATA // echo '<pre>',print_r($data, true),'</pre>'; result Array ( [0] => Array ( [name] => Supervisors [data] => Array ( [0] => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 1 [10] => 2 [11] => 2 [12] => 2 [13] => 2 [14] => 2 [15] => 2 [16] => 2 [17] => 2 [18] => 2 [19] => 2 [20] => 1 [21] => 1 [22] => 0 [23] => 0 ) ) [1] => Array ( [name] => Staff [data] => Array ( [0] => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 5 [10] => 8 [11] => 8 [12] => 8 [13] => 8 [14] => 8 [15] => 8 [16] => 8 [17] => 8 [18] => 8 [19] => 8 [20] => 3 [21] => 3 [22] => 0 [23] => 0 ) ) )
-
desc is a reserved word, it needs to be in backticks (or, better, renamed)
-
buttons are not working on a login system
Barand replied to Michael_Baxter's topic in PHP Coding Help
Your form does not have a submit button, just a button, unless your formhash() function submits the form. -
here's one way $arr = [ '2016-02-24 16:55', '2016-02-24 17:55', '2016-02-24 19:55', '2016-02-24 23:55', '2016-02-24 00:35', '2016-02-24 01:34' ]; for ($i=1, $j=0, $k=count($arr); $i<$k; $i++, $j++) { $dj = new DateTime($arr[$j]); $di = new DateTime($arr[$i]); if ($di < $dj) { $arr[$i] = $di->modify('+1 days')->format('Y-m-d H:i'); } } echo '<pre>',print_r($arr, true),'</pre>'; /* RESULT ************* Array ( [0] => 2016-02-24 16:55 [1] => 2016-02-24 17:55 [2] => 2016-02-24 19:55 [3] => 2016-02-24 23:55 [4] => 2016-02-25 00:35 [5] => 2016-02-25 01:34 ) ****************************/
-
Replace the AND in the ORDER BY with a comma ...ORDER BY t2.`turma` , t1.`nome` ASC
-
http://php.net/manual/en/features.file-upload.multiple.php
-
... WHERE date BETWEEN CURDATE() - INTERVAL 1 MONTH AND CURDATE() - INTERVAL 14 DAY
-
If you can't work out that my name on my posts is in exactly the same place that your name is on your posts, then I am not sure you are ready for this. Anyway, your table should look like this. no | seq | s_line_no -----+--------+------------ 32 | 1 | 315 34 | 1 | 12R 34 | 2 | 12R 34 | 3 | 12R 35 | 1 | 12R 37 | 1 | Other If the user enters more than one value then you write more than one row. Now all you need is a count of the rows where s_line_no = 12R to get the answer of 4.
-
Normalize you data so you have the values in a single column on multiple rows and your problem goes away. Using db tables like spreadsheets is never a good idea.
-
Table and column names should not be in single quotes. I would have expected you get an error message when you ran it in phpmyadmin.
-
Don't know what your column names are but something along these lines SELECT id, COUNT(*) as tot FROM tablename GROUP BY id
-
Here's an example <?php $width = 140; $height = 140; $rad = 60; $dtheta = M_PI/10; $im = "<svg width=\"$width\" height=\"$height\" viewBox=\"0 0 $width $height\" >\n <rect x='1' y='1' width='$width' height='$height' fill='black' />\n <g transform='translate(70,70)'>\n <circle cx='0' cy='0' r='$rad' stroke='white' fill='none' />\n"; for ($theta=0; $theta<2*M_PI; $theta+=$dtheta) { $x = $rad*cos($theta); $y = $rad*sin($theta); $im .= "<circle cx='$x' cy='$y' r='5' fill='cyan' />\n"; } $im .= "</g></svg>\n"; echo $im; ?>
-
0,0 is usually at the top left corner of the image.
-
All you need is theta. You have 20 objects so theta will start at zero and increase by 2*PI/20 for each one. Then, as in the diagram, if the circle has radius R and its centre is at cx,cy the x,y coordinates for each object are x = cx + R * cos(theta) y = cy - R * sin(theta)
-
You have already asked this same question here http://forums.phpfreaks.com/topic/300712-hoursminutes-drop-downs/?do=findComment&comment=1530668 Don't create multiple threads with the same topic. Closing this one.
-
If you want them spaced around the circumference then the attached diagram will tell you what you need to know
-
-
From what you have said, a lesson can have many classes and each class has many lessons. You therefore have a many-to-many relationship between class and lesson. This would be resolved by using another table to link the two. In this case I suggest it could be a "timetable" table which schedules when each class has a lesson. (See attached model) Given a class it is then easy to find the students in that class. Following the links in the diagram you can find which lessons a student has.
-
Not sure we have the full picture yet Can a student belong to more than one class? Can a student have more than one private lesson? Can a class have more than one one private lesson?
-
How to pass the array value to the function
Barand replied to Fabio_Siqueira's topic in Third Party Scripts
Closing this topic as you have reposted it in another of the forums -
Sorry, Ian. Life's too short for this. Good luck.