-
Posts
24,602 -
Joined
-
Last visited
-
Days Won
830
Everything posted by Barand
-
Looking for a string within some text and wrapping it with a link
Barand replied to mongoose00318's topic in PHP Coding Help
I think I'd prefer to see some of the data you are dealing with first. What does the data in drawings_pdf_files and production_data tables look like (few sample records)? What is the structure of production data table? -
I think he wants $start = ($page - 1) * $limit The hard-coded 50 will give problems if $limit becomes something other than 50.
-
Looking for a string within some text and wrapping it with a link
Barand replied to mongoose00318's topic in PHP Coding Help
"sans regex" method <?php $str = "CONOCO 1'10x8 VC DF TP SGN||PRINCIPAL ILLUMINATION||ENG: CO3028TP_0VPR||DWG: CO200428||TO BE: DYED DIESEL (SPEC)||"; $result = ''; $link = 'DWG: <a href="http://www.domain.com?drawing=#">#</a>'; $p1 = $p2 = 0; while (($p1 = strpos($str, 'DWG:', $p2)) !== false) { $result .= substr($str, $p2, $p1 - $p2); $p2 = strpos($str, '||', $p1+4); $drwg = trim(substr($str, $p1+4, $p2 - ($p1 + 4))); $result .= str_replace('#', $drwg, $link); } $result .= substr($str, $p2); echo $str . '<br>' . $result; ?> -
You could roll your own. function twoColorCircle($a, $b, $sz) { $out = "<svg width='$sz' height='$sz' viewBox='0 0 1000 1000'> <linearGradient id='grad2' x1='0' y1='0' x2='1' y2='0'> <stop offset='0%' style='stop-color:$a'/> <stop offset='50%' style='stop-color:$a'/> <stop offset='50%' style='stop-color:$b'/> <stop offset='100%' style='stop-color:$b'/> </linearGradient> "; $c = 500; $r = 499; $out .= "<circle cx='$c' cy='$c' r='$r' fill='url(#grad2)' stroke='#000' /> </svg>"; return $out; } foreach ([16,32,64,128,256] as $sz) echo twoColorCircle('#5fc75d' , '#f19e2d' , $sz); echo '<br>'; foreach (['16em','8em','4em','2em','1em'] as $sz) echo twoColorCircle('#5fc75d' , '#f19e2d' , $sz);
-
Post in the "job Offerings" section of this site and provide contact information.
-
I enjoy the challenge when someone posts a problem I can get my teeth into.
-
Changing array keys using another array
Barand replied to NotionCommotion's topic in PHP Coding Help
Not a one-liner, but still shorter foreach ($keys as $i => $k) { @list($k1, $k2) = explode('_', $k); if ($k2) $$k1[$k2] = array_column($arrayValues, $i); else $$k1 = array_column($arrayValues, $i); } -
A problem with queries like that - there is no "exit" instruction. As I said, better to get the necessary data with the query +---------+----------+----------------+---------------------+----------------+------------+---------------------+---------------------+-----------+---------------------+---------------------+ | task_id | username | task_type | task_start | duration_hours | date | day_start | day_end | day_hours | hol_start | hol_end | +---------+----------+----------------+---------------------+----------------+------------+---------------------+---------------------+-----------+---------------------+---------------------+ | 1 | User 1 | Boiler Install | 2020-06-23 08:00:00 | 9 | 2020-06-23 | 2020-06-23 08:00:00 | 2020-06-23 16:00:00 | 7.5000 | NULL | NULL | | 1 | User 1 | Boiler Install | 2020-06-23 08:00:00 | 9 | 2020-06-24 | 2020-06-24 08:00:00 | 2020-06-24 16:00:00 | 7.5000 | 2020-06-24 08:00:00 | 2020-06-24 10:00:00 | | 1 | User 1 | Boiler Install | 2020-06-23 08:00:00 | 9 | 2020-06-25 | 2020-06-25 08:00:00 | 2020-06-25 16:00:00 | 7.5000 | NULL | NULL | | 1 | User 1 | Boiler Install | 2020-06-23 08:00:00 | 9 | 2020-06-26 | 2020-06-26 08:00:00 | 2020-06-26 16:00:00 | 7.5000 | NULL | NULL | | 1 | User 1 | Boiler Install | 2020-06-23 08:00:00 | 9 | 2020-06-29 | 2020-06-29 08:00:00 | 2020-06-29 16:00:00 | 7.5000 | NULL | NULL | | 1 | User 1 | Boiler Install | 2020-06-23 08:00:00 | 9 | 2020-06-30 | 2020-06-30 08:00:00 | 2020-06-30 16:00:00 | 7.5000 | NULL | NULL | | 2 | User 2 | Piping | 2020-06-24 08:00:00 | 8 | 2020-06-24 | 2020-06-24 08:00:00 | 2020-06-24 12:00:00 | 4.0000 | NULL | NULL | | 2 | User 2 | Piping | 2020-06-24 08:00:00 | 8 | 2020-06-25 | 2020-06-25 12:00:00 | 2020-06-25 16:30:00 | 4.0000 | NULL | NULL | | 2 | User 2 | Piping | 2020-06-24 08:00:00 | 8 | 2020-06-26 | 2020-06-26 08:00:00 | 2020-06-26 16:00:00 | 7.5000 | NULL | NULL | | 2 | User 2 | Piping | 2020-06-24 08:00:00 | 8 | 2020-06-29 | 2020-06-29 08:00:00 | 2020-06-29 16:00:00 | 7.5000 | NULL | NULL | | 2 | User 2 | Piping | 2020-06-24 08:00:00 | 8 | 2020-06-30 | 2020-06-30 08:00:00 | 2020-06-30 16:00:00 | 7.5000 | NULL | NULL | | 2 | User 2 | Piping | 2020-06-24 08:00:00 | 8 | 2020-07-01 | 2020-07-01 08:00:00 | 2020-07-01 12:00:00 | 4.0000 | NULL | NULL | +---------+----------+----------------+---------------------+----------------+------------+---------------------+---------------------+-----------+---------------------+---------------------+ the process the results to get the output, EG <?php include 'db_inc.php'; $db = pdoConnect('neo'); const DT_FORMAT = 'j M g:i a'; const HRS_PER_DAY = 10; const PIX_PER_HR = 12; const PIX_PER_ROW = 30; const HEAD_HT = 50; $wk_commence_date = $_GET['wkcomm'] ?? '2020-06-22'; $res = $db->prepare("SELECT task_id , CONCAT('User ', u.user_id) as username , task_type , task_start , duration_hours , date , CONCAT(date, ' ', day_start) as day_start , CONCAT(date, ' ', day_end) as day_end , day_hours , hol_start , hol_end FROM ( SELECT ot.task_id , ot.user_id , tt.task_type , tt.duration_hours , ot.start_timestamp as task_start , ot.start_timestamp + INTERVAL (duration_hours DIV 7.5) DAY -- whole days + INTERVAL 60 * (duration_hours - (duration_hours DIV 7.5)*7.5) MINUTE -- remaining portion on final day as task_end FROM operatives_tasks ot JOIN tasks USING (task_id) JOIN task_types tt USING (task_type_id) WHERE date(ot.start_timestamp) BETWEEN ? AND ? + INTERVAL 4 DAY ) task JOIN users u ON task.user_id = u.user_id LEFT JOIN ( SELECT date , och.user_id , och.start_time as day_start , och.finish_time as day_end , (timestampdiff(MINUTE, och.start_time, och.finish_time) - (timestampdiff(MINUTE, och.start_time, och.finish_time) DIV 270 ) * 30) / 60 as day_hours , oal.start_timestamp as hol_start , oal.end_timestamp as hol_end FROM date LEFT JOIN operative_contracted_hours och ON weekday(date) = och.week_day LEFT JOIN operatives_annual_leave oal ON oal.start_timestamp < CONCAT(date, ' ', och.finish_time) AND oal.end_timestamp > CONCAT(date, ' ', och.start_time) AND och.user_id = oal.user_id ) days ON task.user_id = days.user_id AND days.date BETWEEN date(task_start) AND date(task_start) + interval 7 day ORDER BY username, task_id, task_start, date "); $res->execute([ $wk_commence_date, $wk_commence_date ]); $data = []; foreach ($res as $r) { if (!isset($data[$r['username']][$r['task_id']])) { $data[$r['username']][$r['task_id']] = [ 'type' => $r['task_type'], 'start' => $r['task_start'], 'end' => '', 'hours' => $r['duration_hours'], 'days' => [] ]; } $data[$r['username']][$r['task_id']]['days'][] = [ 'date' => $r['date'], 'dstart' => $r['day_start'], 'dend' => $r['day_end'], 'dhours' => $r['day_hours'], 'hstart' => $r['hol_start'], 'hend' => $r['hol_end'] ]; } function processUser($tasks, $wk_commence_date) { $ktasks = count($tasks); $chartht = $ktasks * PIX_PER_ROW + HEAD_HT; $chartwid = 500 + 5 * HRS_PER_DAY * PIX_PER_HR; $id_x = 5; $type_x = $chart = "<svg width='$chartwid' height='$chartht'> <style type='text/css'> .work {fill: #2DABE1; stroke-width: 0} .leave {fill: #C38E31; stroke-width: 0} .nonwork {fill: #CCCCCC; stroke-width: 0} .bkgrd {fill: #000; stroke: #EEE; stroke-width: 1} .grid {fill:transparent; stroke: #FFF; stroke-width: 1} .gridh {fill:transparent; stroke: #666; stroke-width: 1} .txt {fill: #FFF; font-size: 8pt; font-family: calibri, sans serif;} </style> <rect x='0' y='0' width='$chartwid' height='$chartht' class='bkgrd' /> <path d='M 500 25 h $chartwid' class='grid' /> <path d='M 0 50 h $chartwid' class='grid' /> \n"; $chart .= "<text x='5' y = '41' class='txt'>Task</text>\n"; $chart .= "<text x='300' y = '41' class='txt'>Start</text>\n"; $chart .= "<text x='400' y = '41' class='txt'>Finish</text>\n"; // times and date headings $dt = new DateTime($wk_commence_date); $dp = new DatePeriod($dt, new DateInterval('P1D'), 5); $x = 500 + HRS_PER_DAY * PIX_PER_HR / 2; $txt_y = HEAD_HT/2 - 9; foreach ($dp as $d) { $chart .= "<text x='$x' y='$txt_y' class='txt' text-anchor='middle'>" . $d->format('j M Y') . "</text>\n"; $x += HRS_PER_DAY * PIX_PER_HR; } for ($x=500; $x<$chartwid; $x += PIX_PER_HR) { $chart .= "<path d='M $x 45 v $chartht' class='gridh' />\n"; } for ($x=500; $x<$chartwid; $x += HRS_PER_DAY * PIX_PER_HR) { $chart .= "<path d='M $x 0 v $chartht' class='grid' />\n"; } $x = 500+PIX_PER_HR; $txt_y = HEAD_HT - 9; for ($d=0; $d<5; $d++) { $x1 = $x; foreach ([9,12,15] as $h) { $chart .= "<text x='$x1' y='$txt_y' class='txt' text-anchor='middle'>$h</text>\n"; $x1 += 3 * PIX_PER_HR; } $x += HRS_PER_DAY * PIX_PER_HR; } $dt = new DateTime($wk_commence_date); $dp = new DatePeriod($dt, new DateInterval('P1D'), 5); $x = 500 + HRS_PER_DAY * PIX_PER_HR / 2; $txt_y = HEAD_HT/2 - 9; foreach ($dp as $d) { $chart .= "<text x='$x' y='$txt_y' class='txt' text-anchor='middle'>" . $d->format('j M Y') . "</text>\n"; $x += HRS_PER_DAY * PIX_PER_HR; } for ($x=500; $x<$chartwid; $x += PIX_PER_HR) { $chart .= "<path d='M $x 45 v $chartht' class='gridh' />\n"; } for ($x=500; $x<$chartwid; $x += HRS_PER_DAY * PIX_PER_HR) { $chart .= "<path d='M $x 0 v $chartht' class='grid' />\n"; } // now do the tasks $tnum = 0; foreach ($tasks as $tid => $tdata) { $chart .= processTask($tnum, $tid, $tdata, $wk_commence_date); } $chart .= "</svg>\n"; return $chart; } function processTask($tnum, $tid, $tdata, $wk_commence_date) { $vOrigin = HEAD_HT + $tnum * PIX_PER_ROW; $txt_y = $vOrigin + PIX_PER_ROW - 9; $sdt = new DateTime($tdata['start']); $start = $sdt->format(DT_FORMAT); $calculated_end = ''; $output = "<text x='5' y='$txt_y' class='txt'>$tid</text> <text x='35' y='$txt_y' class='txt'>{$tdata['type']}</text> <text x='300' y='$txt_y' class='txt'>$start</text> \n"; // process each day until task completion is reached foreach ($tdata['days'] as $dayno => $d) { $output .= processDay($wk_commence_date, $vOrigin, $tdata, $d); } return $output; } function processDay($wk_commence_date, $vOrigin, &$tdata, $d) { if ($d['dend'] < $tdata['start']) return ''; if ($tdata['hours'] <= 0) return; $chart_day_start = new DateTime($d['date'] . ' 08:00:00'); $chart_day_end = new DateTime($d['date'] . ' 18:00:00'); $day_start = new DateTime($d['dstart']); $day_end = new DateTime($d['dend']); $output = ''; $top = $vOrigin + 5; $rHt = PIX_PER_ROW - 10; // non-work // if ($day_start > $chart_day_start) { // $x1 = hOffset($chart_day_start, $wk_commence_date); // $wid = hOffset($day_start, $wk_commence_date) - $x1; // $output .= "<rect x='$x1' y='$top' width='$wid' height='$rHt' class='nonwork' />\n"; // } // if ($day_end < $chart_day_end) { // $x1 = hOffset($day_end, $wk_commence_date); // $wid = hOffset($chart_day_end, $wk_commence_date) - $x1; // $output .= "<rect x='$x1' y='$top' width='$wid' height='$rHt' class='nonwork' />\n"; // } $x1 = hOffset($chart_day_start, $wk_commence_date); $wid = hOffset($chart_day_end, $wk_commence_date) - $x1; $output .= "<rect x='$x1' y='$top' width='$wid' height='$rHt' class='nonwork' />\n"; // holidays if ($d['hstart']) { $hol_start = new DateTime($d['hstart']); $hol_end = new DateTime($d['hend']); $dth1 = max($hol_start, $chart_day_start); $dth2 = min($hol_end, $chart_day_end); $x1 = hOffset($dth1, $wk_commence_date); $wid = hOffset($dth2, $wk_commence_date) - $x1; $output .= "<rect x='$x1' y='$top' width='$wid' height='$rHt' class='leave' />\n"; if ($hol_start <= $day_start) { $day_start = $hol_end; } else $day_end = $hol_start; $d['hours'] = ($day_end->getTimestamp() - $day_start->getTimestamp())/3600; } if ($tdata['hours'] <= $d['dhours']) { $day_end = clone $day_start; $mins = $tdata['hours'] * 60; $day_end->add(new DateInterval("PT{$mins}M")); $tdata['hours'] = 0; } else { $tdata['hours'] -= $d['dhours']; } $x1 = hOffset($day_start, $wk_commence_date); $wid = hOffset($day_end, $wk_commence_date) - $x1; $output .= "<rect x='$x1' y='$top' width='$wid' height='$rHt' class='work' />\n"; if ($d['dhours'] > 4.5) { $break_start = clone $day_start; $break_start->add(new DateInterval('PT270M')); $x1 = hOffset($break_start, $wk_commence_date); $wid = PIX_PER_HR / 2; $output .= "<rect x='$x1' y='$top' width='$wid' height='$rHt' class='nonwork' />\n"; } if ($tdata['hours'] == 0) { $txt_y = $vOrigin + 21; $output .= "<text x='400' y='$txt_y' class='txt'>" . $day_end->format(DT_FORMAT) . "</text>\n"; } return $output; } function hOffset (DateTime $time, $wk_commence_date) { $dt1 = new DateTime($wk_commence_date); $dt2 = clone $time; $day_offset = $dt1->diff($time)->d * HRS_PER_DAY * PIX_PER_HR + 500; $dt2->setTime(8,0,0); $hour_offset = ($time->getTimestamp() - $dt2->getTimestamp())/3600 * PIX_PER_HR; return $day_offset + $hour_offset; } ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="creation-date" content="05/10/2019"> <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> <title>Schedule</title> <style type="text/css"> body { font-family: verdana,sans-serif; font-size: 10pt; padding: 20px 50px; } </style> </head> <body> <header class="w3-container w3-blue-gray w3-center"> <h1>NEO Schedule</h1> </header> <div class="w3-container w3-left"> <?php foreach ($data as $username => $tasks) { echo "<h3>$username</h3>\n"; echo processUser($tasks, $wk_commence_date); } ?> </div> </body> </html> I just noticed it's not quite right yet - the second one should finish at 8:30, not 9am. But it's well on the way
-
Unnecessary, but harmless.
-
Didn't you get the memo about the regulation of working hours for AI?
-
For tasks like this, a really useful addition to any database is a date table (either permanent or temporary containing just the required range of dates CREATE TABLE `date` ( `date` date NOT NULL, PRIMARY KEY (`date`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; For this I just created date records from June 15 to July 15. I also assume in the following query that no task will go over 7 days (change as required) The purpose of the query is to give the task details and the day-by-day hours workable. From hereon I would recommend looping through the query results (in PHP) until the task is completed. I don't think the effort required to do it all in SQL is worth it. SELECT task_id , u.user_id , task_type , task_start , duration_hours , date , day_start , day_end , day_hours , hol_start , hol_end FROM ( SELECT ot.task_id , ot.user_id , tt.task_type , tt.duration_hours , ot.start_timestamp as task_start , ot.start_timestamp + INTERVAL (duration_hours DIV 7.5) DAY -- whole days + INTERVAL 60 * (duration_hours - (duration_hours DIV 7.5)*7.5) MINUTE -- remaining portion on final day as task_end FROM operatives_tasks ot JOIN tasks USING (task_id) JOIN task_types tt USING (task_type_id) ) task JOIN users u ON task.user_id = u.user_id LEFT JOIN ( SELECT date , och.user_id , och.start_time as day_start , och.finish_time as day_end , (timestampdiff(MINUTE, och.start_time, och.finish_time) - (timestampdiff(MINUTE, och.start_time, och.finish_time) DIV 270 ) * 30) / 60 as day_hours , oal.start_timestamp as hol_start , oal.end_timestamp as hol_end FROM date LEFT JOIN operative_contracted_hours och ON weekday(date) = och.week_day LEFT JOIN operatives_annual_leave oal ON oal.start_timestamp < CONCAT(date, ' ', och.finish_time) AND oal.end_timestamp > CONCAT(date, ' ', och.start_time) AND och.user_id = oal.user_id ) days ON task.user_id = days.user_id AND days.date BETWEEN date(task_start) AND date(task_start) + interval 7 day ORDER BY task_id, date; I added a second user with different working hours and a second task. +---------+---------+----------------+---------------------+----------------+------------+-----------+----------+-----------+---------------------+---------------------+ | task_id | user_id | task_type | task_start | duration_hours | date | day_start | day_end | day_hours | hol_start | hol_end | +---------+---------+----------------+---------------------+----------------+------------+-----------+----------+-----------+---------------------+---------------------+ | 1 | 1 | Boiler Install | 2020-06-23 08:00:00 | 9 | 2020-06-23 | 08:00:00 | 16:00:00 | 7.5000 | NULL | NULL | | 1 | 1 | Boiler Install | 2020-06-23 08:00:00 | 9 | 2020-06-24 | 08:00:00 | 16:00:00 | 7.5000 | 2020-06-24 08:00:00 | 2020-06-24 10:00:00 | | 1 | 1 | Boiler Install | 2020-06-23 08:00:00 | 9 | 2020-06-25 | 08:00:00 | 16:00:00 | 7.5000 | NULL | NULL | | 1 | 1 | Boiler Install | 2020-06-23 08:00:00 | 9 | 2020-06-26 | 08:00:00 | 16:00:00 | 7.5000 | NULL | NULL | | 1 | 1 | Boiler Install | 2020-06-23 08:00:00 | 9 | 2020-06-29 | 08:00:00 | 16:00:00 | 7.5000 | NULL | NULL | | 1 | 1 | Boiler Install | 2020-06-23 08:00:00 | 9 | 2020-06-30 | 08:00:00 | 16:00:00 | 7.5000 | NULL | NULL | | 2 | 2 | Boiler Install | 2020-06-24 08:00:00 | 9 | 2020-06-24 | 08:00:00 | 12:00:00 | 4.0000 | NULL | NULL | | 2 | 2 | Boiler Install | 2020-06-24 08:00:00 | 9 | 2020-06-25 | 12:00:00 | 16:00:00 | 4.0000 | NULL | NULL | | 2 | 2 | Boiler Install | 2020-06-24 08:00:00 | 9 | 2020-06-26 | 08:00:00 | 16:00:00 | 7.5000 | NULL | NULL | | 2 | 2 | Boiler Install | 2020-06-24 08:00:00 | 9 | 2020-06-29 | 08:00:00 | 16:00:00 | 7.5000 | NULL | NULL | | 2 | 2 | Boiler Install | 2020-06-24 08:00:00 | 9 | 2020-06-30 | 08:00:00 | 16:00:00 | 7.5000 | NULL | NULL | | 2 | 2 | Boiler Install | 2020-06-24 08:00:00 | 9 | 2020-07-01 | 08:00:00 | 12:00:00 | 4.0000 | NULL | NULL | +---------+---------+----------------+---------------------+----------------+------------+-----------+----------+-----------+---------------------+---------------------+
-
Why not heed the reply you got last time you posted this link?
-
which translates to if (one or more of the fields has something in it) { // do nothing } else { // process the data } It is far better to put a unique constraint on your email column and then insert the record to see if it fails with a duplicate key error.. it saves a query to see if it's there Just because you didn't find it doesn't mean it won't be there when you do your insert (some could have beaten you to it).
-
At its most basic (standard days and no holidays) you have something like this SELECT ot.task_id , tt.duration_hours , ot.start_timestamp , start_timestamp + INTERVAL (duration_hours DIV 7.5) DAY -- whole days + INTERVAL 60 * (duration_hours - (duration_hours DIV 7.5)*7.5) MINUTE -- remaining portion on final day as end_timestamp , . . . Example mysql> select '2020-06-23 08:00:00' -> + INTERVAL (9 DIV 7.5) DAY -> + INTERVAL 60 * (9 - (9 DIV 7.5)*7.5) MINUTE -> as end_time; +---------------------+ | end_time | +---------------------+ | 2020-06-24 09:30:00 | +---------------------+ Now you have a planned start and end you can look for holiday periods (and weekends) that overlap this work period. Here there are two conditions: holiday start <= start_timestamp task delayed, start_timestamp becomes the holiday end date but actual duration remains the same holiday start > start_timestamp work is interrupted for the duration of the whole holiday so holiday duration is added to task actual duration When you deviate from standard length days though, it becomes a whole lot more complex as each day's length and breaks (if applicable) need to be considered separately
-
Suppose a task takes 10 hours. They start at 08:00 on day 1, take a 30 min break (12:30 - 13:00) then work until 16:00. They have now done 7.5 hours with 2.5 hour to go. Day2, starts at 08:00 but at 09:30 they have done another 4.5 hours on that task so break until 10:00 and finishes the task at 11:00. On to the next task - at 15:30 is due another break after 4.5 hours work so has break and goes home at 16:00 having had two breaks that day (7 hours work)
-
Do all users always work the same hours every day? EG Wednesday 08:00 - 12:00 = short day and no break) What if a boiler installation starts at 3pm on a Friday?
-
That query doesn't require preparation - there are no user-provided values. Also your use of single quotes around the column aliases is wrong, and you have a comma missing after B1 $sel_query = "SELECT S1 , B1 , SUM(S1 = 'Accepted') `Accepted` , SUM(S1 = 'Rejected') `Rejected` , SUM(S1 = 'Under Review') `Under_Review` FROM Enrol"; $result = $conn->query($sel_query);
-
How to change seconds into Days, Hours, Minutes, Seconds
Barand replied to Lux05's topic in PHP Coding Help
One way is... $secs = 350000; $dt1 = new DateTime(); $dt2 = (clone $dt1)->add(new DateInterval('PT'.$secs.'S')); $diff = $dt1->diff($dt2); echo $diff->days . ' : ' . $diff->format('%h : %i : %s').'<br>'; //-> 4 : 1 : 13 : 20 -
What are the rules for this calculation? If your working days are 8 - 4, that's at least 5 tea-breaks
-
I too prefer always to have the ";" at the statement ends in the main code but I don't bother with it when I use something like <?= $username ?>
-
SELECT total as c , id , owner FROM cities CROSS JOIN ( SELECT COUNT(*) as total FROM cities WHERE owner IN (21, 37) ) tot WHERE owner IN (21, 37); What determines that those owner ids being searched for should be 21 and 37? Are they the result of another query (to find those in a "set")?
-
Perhaps if you gave us some sample input data and then tell us what your desired output is from that data. Then we might understand what you mean.
-
@roirc https://translate.google.com/ Use it before posting Folosiți-o înainte de a posta
-
Are you now telling us that the php code that wasn't working was in a .html file and not in a .php file?