Jump to content

Barand

Moderators
  • Posts

    24,572
  • Joined

  • Last visited

  • Days Won

    824

Everything posted by Barand

  1. 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
  2. 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;
  3. 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?
  4. pseudocode start = 0 loop call get_contact_list() using start start += 25 if no contacts returned exit loop end if process contacts end loop
  5. see http://www.web-development-blog.com/archives/send-e-mail-messages-via-smtp-with-phpmailer-and-gmail/
  6. 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
  7. http://lmgtfy.com/?q=news+ticker+for+website
  8. 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?
  9. 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']; }
  10. 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; }
  11. 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 ) )
  12. I'm guessing there is something else going on $email = '[email protected]'; $email = str_replace('yahooo','yahoo',$email); echo $email; //--> [email protected]
  13. 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 | +------------+--------+------+---------+
  14. 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
  15. 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
  16. 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
  17. that is labeled EditPost.php and form calls EditPost2.php ??
  18. $_GET ? All the other input comes from $_POST
  19. you may need to restart you server software (Apache, IIS) after changing the ini file.
  20. An ini file is *not* a php file and doesn't contain code. It should look like this in the ini file error_reporting = E_ALL display_errors = On
  21. .htaccess? That code should be at the top of your script or, better, set in the ini file. phpinfo() will tell you where your current ini file is.
  22. Have you got php error reporting turned on?
  23. Ask it what the error is. if ($conn->execute()) { header('location: inventory.php?Msg=Update'); } else echo $conn->error;
  24. Also when you bind_params you have 'sssiii' and 7 params and 7 placeholders. (In your second version only 6 params - you forgot the id)
×
×
  • 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.