-
Posts
24,565 -
Joined
-
Last visited
-
Days Won
822
Everything posted by Barand
-
Look at 2 different MySQL queries and find difference
Barand replied to jubba890's topic in PHP Coding Help
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? -
Creating an array from two columns of a Mysql database
Barand replied to ajoo's topic in PHP Coding Help
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']; } -
Creating an array from two columns of a Mysql database
Barand replied to ajoo's topic in PHP Coding Help
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; } -
A database of nouns,adverbs,verbs...
Barand replied to moose-en-a-gant's topic in Application Design
Then there is and -
delete values from an array and place those values in another array
Barand replied to kalster's topic in PHP Coding Help
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 ) ) -
I'm guessing there is something else going on $email = '[email protected]'; $email = str_replace('yahooo','yahoo',$email); echo $email; //--> [email protected]
-
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 | +------------+--------+------+---------+
-
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
-
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
-
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
-
that is labeled EditPost.php and form calls EditPost2.php ??
-
$_GET ? All the other input comes from $_POST
-
you may need to restart you server software (Apache, IIS) after changing the ini file.
-
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
-
.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.
-
Have you got php error reporting turned on?
-
Ask it what the error is. if ($conn->execute()) { header('location: inventory.php?Msg=Update'); } else echo $conn->error;
-
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)
-
Your problem is most likely the checkboxes. If a checkbox is not checked the no data is posted so you need to check $showmodel - isset($_POST['showmodel']) ? 1 : 0; // set value if isset
-
The form method should be "GET" and not "$_GET" (although you get away with probably as GET is the default). Having changed the form, $_GET is what you should now be using in the php code instead of $_POST
-
Yes and no. You evidently have more privs than me as another Guru. [edit] Or maybe not - if I hover over your name in this thread I see the spammer icon.
-
The only icon that I see for anyone (even first time posters) is "Add as friend"
-
Thanks, working OK now. I see 8 notifications (3 new ones)
-
Inputs are posted by name, so you need $keyword = $_POST['keyword'];
-
You don't have an input with name = search so you end up with "LIKE '%%' " which is everything