[PHP] Split/Group date together.
Hello again. In my program I have this: mysql> SELECT * FROM transportdokument WHERE dato >= '16/7/2013' AND dato <= '18/7/2013'; This list all reccrds for 3 days. I need a way to split it up for every day even when the requst is as above and don't know in what way I can do it. I like to have all records for day 16 in one table in PHP/HTML and all records for day 17 in another table. i.e, Day 16 have 5 rows and day 17th and 18th have 7 and 8 rows. I hope for your help and advice to do also this correct. Thank you for your time and effort! Karl
Re: [PHP] Split/Group date together.
Normally, what I do here is handle that in the loop to display the records ... so start by adding an order by clause to keep the dates together SELECT * FROM transportdokument WHERE dato >= '16/7/2013' AND dato <= '18/7/2013' order by dato $prior_date = ""; $sHTML = ""; while($rows = mysql_fetch_array($result)){ if ($prior_date != $rows['dato']){ if($open_table){ $sHTML .= ""; $prior_date = $rows['dato']; } } $sHTML .= ""; $sHTML .= "". $rows['dato'] . ""; $sHTML .= "". $rows['some_field'] . ""; $sHTML .= "". $rows['another_field'] . ""; $sHTML .= "". $rows['third_field'] . ""; $sHTML .= ""; } $sHTML .= ""; On Thu, Jul 18, 2013 at 9:43 AM, Karl-Arne Gjersøyen wrote: > Hello again. > In my program I have this: > > mysql> SELECT * FROM transportdokument WHERE dato >= '16/7/2013' AND dato > <= '18/7/2013'; > > This list all reccrds for 3 days. I need a way to split it up for every day > even when the requst is as above and don't know in what way I can do it. > > I like to have all records for day 16 in one table in PHP/HTML and all > records for day 17 in another table. > i.e, Day 16 have 5 rows and day 17th and 18th have 7 and 8 rows. > > I hope for your help and advice to do also this correct. > > Thank you for your time and effort! > > Karl > -- Bastien Cat, the other other white meat
Re: [PHP] Split/Group date together.
If I understand you correctly, I call what you're trying to do "PHP group by", and did a write up on it a few years back: http://www.garfieldtech.com/blog/php-group-by-with-arrays --Larry Garfield On 7/18/13 8:43 AM, Karl-Arne Gjersøyen wrote: Hello again. In my program I have this: mysql> SELECT * FROM transportdokument WHERE dato >= '16/7/2013' AND dato <= '18/7/2013'; This list all reccrds for 3 days. I need a way to split it up for every day even when the requst is as above and don't know in what way I can do it. I like to have all records for day 16 in one table in PHP/HTML and all records for day 17 in another table. i.e, Day 16 have 5 rows and day 17th and 18th have 7 and 8 rows. I hope for your help and advice to do also this correct. Thank you for your time and effort! Karl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and Powershell
Good morning everyone, First time posting in here, although I've been listening in for a few weeks now. So this one has got me stumped, I am fairly new to PHP but I cannot seem to Google through this one. I cannot figure out how to 'exclude' PSComputerName and RunspaceId, which is ultimately what I'm struggling with. Please see below for script snips and explanations. Also if there are any best practices you would recommend I'm open to it being that I am fairly new and self-taught to PHP scripting. I have a bit of code I've put together (as ugly as it is) as follows in line: '); print_r($out); echo (''); ### ## End Of Script ## ### echo "End Of Scene"; ?> The issue I have is that it feeds back: Array ( [0] => iqn.2013-04.com.widget:Target1 [1] => [2] => PSComputerName RunspaceId Value [3] => -- -- - [4] => 127.0.0.1 52fb8b1b-8d8b-4eec-9419... NotConnected [5] => [6] => ) End Of Scene What I should see so I can then turn it into variables is what I run when I run the command straight through the local Powershell command prompt which would return: PS C:\Users\administrator.WIDGET.000> Get-IscsiServerTarget | % { $_.TargetIqn, $_.Status} iqn.2013-04.com.widget:Target1 NotConnected iqn.2013-04.com.widget:Target2 NotConnected iqn.2013-04.com.widget:Target3 NotConnected iqn.2013-04.com.widget:Target4 Connected iqn.2013-04.com.widget:Target5 NotConnected iqn.2013-04.com.widget:Target6 NotConnected I cannot figure out how to 'exclude' PSComputerName and RunspaceId Sorry in advance for the wordy explanation. Cheers! Alan Please make note of my new email address: alan.l...@genco.com. CONFIDENTIALITY NOTICE: This e-mail and the attachment(s) hereto (if any) contain confidential information that is privileged and intended only for the addressee(s) hereof. If you are not an intended recipient, you are hereby notified that any disclosure, copying, distribution or use of this e-mail and/or the accompanying attachment(s) is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender by return e-mail.
[PHP] I am completely lost and need an advice (beginner)
Hello world! I'm trying to learn PHP ( first programming language that I learn) and I feel kinda lost. I've read PHP programming 3rd edition( O'reilly), 'getting good with PHP' by Andrew Burgees and some tutorials on the internet but can't code something more complex than 'hello world'. I do understand functions/values/operators/control structures, etc but as I said, I feel that I can't use the language. Am I reading the wrong books for a beginner? Any advices? *Apologies if this email might seem confusing. :) Richard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I am completely lost and need an advice (beginner)
On Fri, Jul 19, 2013 at 1:08 AM, php colos wrote: > Am I reading the wrong books for a beginner? > Do you just read the book or also do what it says to do? If you just read but dont code along with it, you may not learn anything. After reading a lot of book you'll feel you have understand a lot of things. But thats true when you read. Not when you code. Just follow the instructions on the book. I hope you'll be able to write a lot of code. -- Shiplu.Mokadd.im ImgSign.com | A dynamic signature machine Innovation distinguishes between follower and leader
Re: [PHP] I am completely lost and need an advice (beginner)
On Thu, Jul 18, 2013 at 3:08 PM, php colos wrote: > Hello world! > > I'm trying to learn PHP ( first programming language that I learn) and > I feel kinda lost. I've read PHP programming 3rd edition( O'reilly), > 'getting good with PHP' by Andrew Burgees and some tutorials on the > internet but can't code something more complex than 'hello world'. > > > I do understand functions/values/operators/control structures, etc but > as I said, I feel that I can't use the language. > Am I reading the wrong books for a beginner? > > Any advices? > > > > *Apologies if this email might seem confusing. :) Perhaps I'm biased, but I think other folks will agree --- the official documentation is your best source of learning second only to your own experiences with the language. Check through the user notes as well, as they often provide very valuable insight and other developers' personal experiences. -- Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I am completely lost and need an advice (beginner)
On 07/18/2013 09:08 PM, php colos wrote: > Hello world! > > I'm trying to learn PHP ( first programming language that I learn) and > I feel kinda lost. I've read PHP programming 3rd edition( O'reilly), > 'getting good with PHP' by Andrew Burgees and some tutorials on the > internet but can't code something more complex than 'hello world'. > > > I do understand functions/values/operators/control structures, etc but > as I said, I feel that I can't use the language. > Am I reading the wrong books for a beginner? > > Any advices? > > > > *Apologies if this email might seem confusing. :) > > Richard > As others have mentioned, reading only isn't a good thing. You'll need to code alongside reading. You also might need to have a goal/project to motivate you to code. Starting small is a good thing. Or you could help out some of the smaller php projects that have only a few coders. Fixing bugs in a project can be a great help, and you'll learn a lot. If you don't have any project in mind, you can go to codecademy.com or some of the other interactive learning sites to start coding. I just checked, they've implemented PHP now, I haven't tried this. But the javascript course is great. cheers Carsten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I am completely lost and need an advice (beginner)
2013/7/18 Carsten Jensen > On 07/18/2013 09:08 PM, php colos wrote: > > Hello world! > > > > I'm trying to learn PHP ( first programming language that I learn) and > > I feel kinda lost. I've read PHP programming 3rd edition( O'reilly), > > 'getting good with PHP' by Andrew Burgees and some tutorials on the > > internet but can't code something more complex than 'hello world'. > > > > > > I do understand functions/values/operators/control structures, etc but > > as I said, I feel that I can't use the language. > > Am I reading the wrong books for a beginner? > > > > Any advices? > > > > > > > > *Apologies if this email might seem confusing. :) > > > > Richard > > > > As others have mentioned, reading only isn't a good thing. You'll need > to code alongside reading. > > You also might need to have a goal/project to motivate you to code. > Starting small is a good thing. Or you could help out some of the > smaller php projects that have only a few coders. Fixing bugs in a > project can be a great help, and you'll learn a lot. > > If you don't have any project in mind, you can go to codecademy.com > or some of the other interactive learning sites to start coding. > I just checked, they've implemented PHP now, I haven't tried this. But > the javascript course is great. > > cheers > Carsten > > > Same here: Just reading doesn't help you very much. You should also consider reading books about programming in general, or even better get in contact with more (or less ;)) experienced programmers, because in my experience learning the syntax and writing code is just a very minor part. Its more important to know how to solve the problems (in a way, that works tomorrow too ;)) is more important. And as a side effect getting help can prevent frustration, if you are stuck in a problem ;) Regards, Sebastian > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- github.com/KingCrunch
[PHP] pass parameter from client to server
I have a select control on the form and need to pass value user select to my query parameter. I just realized that user entry value is client side and query parameter is server side. Are there any way to read client parameter to pass to server? You information and help is great appreciated, Regards, Iccsi, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pass parameter from client to server
On Thu, Jul 18, 2013 at 6:04 PM, iccsi wrote: > I have a select control on the form and need to pass value user select to my > query parameter. > I just realized that user entry value is client side and query parameter is > server side. > Are there any way to read client parameter to pass to server? > > You information and help is great appreciated, Not from PHP unless you pass it via GET or POST, or as a cookie. You may want to look into JavaScript, jQuery, and AJAX for your specific needs, but that all gets beyond the scope of this list. -- Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pass parameter from client to server
On Jul 18, 2013, at 6:07 PM, Daniel Brown wrote: > On Thu, Jul 18, 2013 at 6:04 PM, iccsi wrote: >> I have a select control on the form and need to pass value user select to my >> query parameter. >> I just realized that user entry value is client side and query parameter is >> server side. >> Are there any way to read client parameter to pass to server? >> >> You information and help is great appreciated, > >Not from PHP unless you pass it via GET or POST, or as a cookie. > You may want to look into JavaScript, jQuery, and AJAX for your > specific needs, but that all gets beyond the scope of this list. Daniel is right. Here's my way to do what you are asking: http://php1.net/a/ajax/ Please examine the javascript that accompanies the demo. It simply sends GET values to a php script that changes the values in the GET Array without a refresh. However, I would not provide such access to a db query without a great deal of cleaning. Cheers, tedd _ tedd.sperl...@gmail.com http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pass parameter from client to server
One additional comment. Please change the javascript onclick to onchange -- that way the demo will work for Chrome as well as other Browsers. Cheers, tedd _ t...@sperling.com http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pass parameter from client to server
Could also use jquery instead Best, -Josh ___ http://byjakt.com Currently mobile On Jul 19, 2013, at 4:08, Tedd Sperling wrote: > > One additional comment. > > Please change the javascript onclick to onchange -- that way the demo will > work for Chrome as well as other Browsers. > > Cheers, > > tedd > > _ > t...@sperling.com > http://sperling.com > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I am completely lost and need an advice (beginner)
On Jul 18, 2013, at 12:28 PM, Daniel Brown wrote: > On Thu, Jul 18, 2013 at 3:08 PM, php colos wrote: >> Hello world! >> >> I'm trying to learn PHP ( first programming language that I learn) and >> I feel kinda lost. I've read PHP programming 3rd edition( O'reilly), >> 'getting good with PHP' by Andrew Burgees and some tutorials on the >> internet but can't code something more complex than 'hello world'. >> >> >> I do understand functions/values/operators/control structures, etc but >> as I said, I feel that I can't use the language. >> Am I reading the wrong books for a beginner? >> >> Any advices? >> >> >> >> *Apologies if this email might seem confusing. :) > >Perhaps I'm biased, but I think other folks will agree --- the > official documentation is your best source of learning second only to > your own experiences with the language. Check through the user notes > as well, as they often provide very valuable insight and other > developers' personal experiences. > > -- I completely agree with Daniel that the online PHP documentation is the best way to understand the language. However, It seems our OP does not understand how to program. The php docs don't help with that. If you really don't understand what programming is useful for, perhaps this is the wrong thing to be learning. That said, what programming is for is to solve problems, provide tools, and provide means for people to communicate with each other and get work done via the computer and the internet. So, key, #1 thing: have a problem to solve. While saying you understand various aspects of the language, I would say you cannot understand them until you actually put them to use, break things, learn how to fix them, and finally, teach someone else how to use them. Almost every text, learning site, and documentation discusses how to write a program or application in the language or using the framework. Very, very few teach the essence of solving problems. Even the classics, such as Knuth's, Djyktra's, Wurth's, and so on, describe ways to solve particular problems. Patterns books describe how to structure solutions, but not actually how to solve problems in a general sense. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pass parameter from client to server
On Jul 18, 2013, at 6:53 PM, Joshua Kehn wrote: > Could also use jquery instead True, but it's good to see the bare javascript as well in a demo. > > Best, > > -Josh > ___ > http://byjakt.com > Currently mobile > > On Jul 19, 2013, at 4:08, Tedd Sperling wrote: > >> >> One additional comment. >> >> Please change the javascript onclick to onchange -- that way the demo will >> work for Chrome as well as other Browsers. >> >> Cheers, >> >> tedd >> >> _ >> t...@sperling.com >> http://sperling.com >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php