Jump to content

Barand

Moderators
  • Posts

    24,602
  • Joined

  • Last visited

  • Days Won

    830

Everything posted by Barand

  1. You need to provide names for the form <selects> eg <select id="selectCountry" name="selectCountry" class="form-control" multiple>
  2. $getquery will either be a mysqli result or, if the query failed, it will be "false". As you get a message saying it is not a result then the query failed and there should be an error message $get = "SELECT * FROM `users`"; $getquery = mysqli_query($db,$get); if (!$getquery) echo $db->error;
  3. See what the error message is with echo $db->error;
  4. Pretty much the same way. An array of counts. $counts=array('pos' => 0, 'neu' => 0, 'neg' => 0); foreach ($strings as $string){ $scores = $sentiment->score($string); $class = $sentiment->categorise($string); $counts[$class]++; // increment count for the class }
  5. And without a day number in your data the sort order will be Fri, Mon, Sat, Sun, Thu, Tue, Wed
  6. You shouldn't have columns ball1, ball2, ... ballN. You should normalize the data correctly so each ball has its own row - then you have a single column to search. See this thread http://forums.phpfreaks.com/topic/295145-cannot-get-these-variables-to-add-up/?do=findComment&comment=1507842
  7. Before you can get the number of rows you need the results After the execute() either $res = $smt->get_result(); echo $res->num_rows; or $smt->store_result(); echo $smt->num_rows;
  8. Needs a rewrite of the pseudocode in that case skip = 0 loop call get_contact_list() using skip skip += 25 if no contacts returned exit loop end if process contacts end loop Is that better?
  9. pseudocode start = 0 loop call get_contact_list() using start start += 25 if no contacts returned exit loop end if process contacts end loop
  10. see http://www.web-development-blog.com/archives/send-e-mail-messages-via-smtp-with-phpmailer-and-gmail/
  11. If the only thing that changes in each of the 10 graphs is the data then use the same "graph.php" but pass the different data (and maybe a caption) each time. Use something like this $data_1 = array(1,2,3); $data_2 = array(5,6,7); $g1_data = json_encode($data_1); // convert to a string $g2_data = json_encode($data_2); // convert to a string echo "<img src='graph.php?caption=chart_1&data=$g1_data' />"; echo "<img src='graph.php?caption=chart_2&data=$g2_data' />"; In graph.php the data will be in $_GET['data'] $data_array = json_decode($_GET['data'], 1); // reconstruct data array // create graph
  12. http://lmgtfy.com/?q=news+ticker+for+website
  13. You should be able to construct the desired list using SQL but your spec needs several ambiguities clarifying Does ones refer to group or servers? Mix of AND and OR - is that A OR (B AND C) (A OR B) AND C TestGroup: - ID: 1 - TYPE: webserver TestGroup: - ID: 1 - TYPE: webserver Both have same ID value Your server and group entities both have type attributes. To which does type refer? another group in respect to what? Is there pre-selection of a group to process?
  14. You would do it as you process the query result // code from above here, then while ($row = $res->fetch_assoc()) { $data[$row['date']] = $row['value']; }
  15. populate an array with the required dates as keys and zero values. Then you add the values from your data into the the array using the date keys $dt1 = new DateTime('2015-02-26'); $dt2 = new DateTime('2015-03-27'); $di = new DateInterval('P1D'); $dp = new DatePeriod($dt1, $di, $dt2); $data = array(); foreach ($dp as $d) { $data[$d] = 0; }
  16. If var1 and var2 never change then you can pre-construct that array then create the third array from the difference $arr = array ( array('var1', 1, 'var2', 2, 3) ); $result[0] = array ('var1', 'var2'); //pre-construct $result[1] = array_values(array_diff($arr[0], $result[0])); echo '<pre>',print_r($result, true),'</pre>'; gives Array ( [0] => Array ( [0] => var1 [1] => var2 ) [1] => Array ( [0] => 1 [1] => 2 [2] => 3 ) )
  17. I'm guessing there is something else going on $email = '[email protected]'; $email = str_replace('yahooo','yahoo',$email); echo $email; //--> [email protected]
  18. Draw results for week would look like this +------------+------+ | draw_date | num | +------------+------+ | 2015-03-07 | 1 | | 2015-03-07 | 4 | | 2015-03-07 | 8 | | 2015-03-07 | 18 | | 2015-03-07 | 19 | | 2015-03-07 | 23 | +------------+------+ The numbers for each member in the draw would look like this +--------+------------+------+ | member | draw_date | num | +--------+------------+------+ | 1 | 2015-03-07 | 1 | | 1 | 2015-03-07 | 4 | | 1 | 2015-03-07 | 9 | | 1 | 2015-03-07 | 18 | | 1 | 2015-03-07 | 19 | | 1 | 2015-03-07 | 22 | | 2 | 2015-03-07 | 2 | | 2 | 2015-03-07 | 7 | | 2 | 2015-03-07 | 8 | | 2 | 2015-03-07 | 16 | | 2 | 2015-03-07 | 19 | | 2 | 2015-03-07 | 24 | | 3 | 2015-03-07 | 1 | | 3 | 2015-03-07 | 4 | | 3 | 2015-03-07 | 8 | | 3 | 2015-03-07 | 19 | | 3 | 2015-03-07 | 21 | | 3 | 2015-03-07 | 23 | +--------+------------+------+ Then to see how many matches each member has for the draw SELECT draw_date , member , COUNT(*) as matches FROM member_number m INNER JOIN draw_result d USING (draw_date, num) WHERE d.draw_date = '2015-03-07' GROUP BY draw_date, member +------------+--------+---------+ | draw_date | member | matches | +------------+--------+---------+ | 2015-03-07 | 1 | 4 | | 2015-03-07 | 2 | 2 | | 2015-03-07 | 3 | 5 | +------------+--------+---------+ If you want to see which numbers match for each member then SELECT m.draw_date , member , m.num , CASE WHEN d.num IS NULL THEN '' ELSE 'Yes' END as matched FROM member_number m LEFT JOIN draw_result d USING (draw_date, num) WHERE m.draw_date = '2015-03-07' ORDER BY m.draw_date, member, m.num +------------+--------+------+---------+ | draw_date | member | num | matched | +------------+--------+------+---------+ | 2015-03-07 | 1 | 1 | Yes | | 2015-03-07 | 1 | 4 | Yes | | 2015-03-07 | 1 | 9 | | | 2015-03-07 | 1 | 18 | Yes | | 2015-03-07 | 1 | 19 | Yes | | 2015-03-07 | 1 | 22 | | | 2015-03-07 | 2 | 2 | | | 2015-03-07 | 2 | 7 | | | 2015-03-07 | 2 | 8 | Yes | | 2015-03-07 | 2 | 16 | | | 2015-03-07 | 2 | 19 | Yes | | 2015-03-07 | 2 | 24 | | | 2015-03-07 | 3 | 1 | Yes | | 2015-03-07 | 3 | 4 | Yes | | 2015-03-07 | 3 | 8 | Yes | | 2015-03-07 | 3 | 19 | Yes | | 2015-03-07 | 3 | 21 | | | 2015-03-07 | 3 | 23 | Yes | +------------+--------+------+---------+
  19. FROM attendees As a INNER JOIN history AS h ON a.attendeeid = h.attendeeid That tells it to match rows from a with those rows from h where the attendeeid values match Now add a WHERE clause to specify what value you want to select WHERE a.attendeeid = :id EG SELECT a.fname, a.lname, h.amount, h.subsidy, h.last_payment, h.amount_paid, h.balance FROM attendees As a INNER JOIN history AS h ON a.attendeeid = h.attendeeid WHERE a.attendeeid = :id
  20. I suggest you re-read a reply I sent to you yesterday http://forums.phpfreaks.com/topic/295128-mysqli-update-not-working/?do=findComment&comment=1507666
  21. the error Notice: Undefined index: id in /edit-item.php on line 9 is from edit-item.php. From what I see you try to set a value of $eid from a non-existent value but then it isn't used after that. The query uses a POST variable
  22. that is labeled EditPost.php and form calls EditPost2.php ??
  23. $_GET ? All the other input comes from $_POST
  24. you may need to restart you server software (Apache, IIS) after changing the ini file.
×
×
  • 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.