php-general Digest 19 Jul 2013 01:53:46 -0000 Issue 8301
Topics (messages 321633 through 321645):
Re: Split/Group date together.
321633 by: Bastien Koert
321634 by: Larry Garfield
PHP and Powershell
321635 by: Alan Loos
I am completely lost and need an advice (beginner)
321636 by: php colos
321637 by: shiplu
321638 by: Daniel Brown
321639 by: Carsten Jensen
321640 by: Sebastian Krebs
pass parameter from client to server
321641 by: iccsi
321642 by: Daniel Brown
321643 by: Tedd Sperling
321644 by: Tedd Sperling
321645 by: Joshua Kehn
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
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 = "<table>";
while($rows = mysql_fetch_array($result)){
if ($prior_date != $rows['dato']){
if($open_table){
$sHTML .= "</table><table>";
$prior_date = $rows['dato'];
}
}
$sHTML .= "<tr>";
$sHTML .= "<td>". $rows['dato'] . "</td>";
$sHTML .= "<td>". $rows['some_field'] . "</td>";
$sHTML .= "<td>". $rows['another_field'] . "</td>";
$sHTML .= "<td>". $rows['third_field'] . "</td>";
$sHTML .= "</tr>";
}
$sHTML .= "</table>";
On Thu, Jul 18, 2013 at 9:43 AM, Karl-Arne Gjersøyen <karlar...@gmail.com>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
--- End Message ---
--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
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:
<?php
###############
## Variables ##
###############
$TargetName = "Target1";
$login = "\$cred = New-Object System.Management.Automation.PSCredential
-ArgumentList @('administra...@widget.com',(ConvertTo-SecureString -String
'MyPassword' -AsPlainText -Force))";
$command = "Invoke-Command -computername 127.0.0.1 -credential \$cred
-scriptblock {& Get-IscsiServerTarget -TargetName " . $TargetName . " | % {
\$_.TargetIqn, \$_.Status}} -SessionOption (New-PSSessionOption -SkipCACheck
-SkipCNCheck -SkipRevocationCheck)";
$psCMD = "powershell -ExecutionPolicy Unrestricted -command \"$login;
$command\" <NUL";
########################################
## Variable Checking (For Debug Mode) ##
########################################
#echo "\$psCMD = $psCMD";
################
## Run Script ##
################
exec($psCMD,$out);
############
## Output ##
############
echo ('<pre>');
print_r($out);
echo ('</pre>');
###################
## 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.
--- End Message ---
--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
On Fri, Jul 19, 2013 at 1:08 AM, php colos <phpco...@gmail.com> 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
--- End Message ---
--- Begin Message ---
On Thu, Jul 18, 2013 at 3:08 PM, php colos <phpco...@gmail.com> 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.
--
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/
--- End Message ---
--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
2013/7/18 Carsten Jensen <to...@tomse.dk>
> 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
--- End Message ---
--- Begin Message ---
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,
--- End Message ---
--- Begin Message ---
On Thu, Jul 18, 2013 at 6:04 PM, iccsi <inu...@gmail.com> 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 P. Brown>
Network Infrastructure Manager
http://www.php.net/
--- End Message ---
--- Begin Message ---
On Jul 18, 2013, at 6:07 PM, Daniel Brown <danbr...@php.net> wrote:
> On Thu, Jul 18, 2013 at 6:04 PM, iccsi <inu...@gmail.com> 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
--- End Message ---
--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
Could also use jquery instead
Best,
-Josh
___________________________
http://byjakt.com
Currently mobile
On Jul 19, 2013, at 4:08, Tedd Sperling <t...@sperling.com> 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
>
--- End Message ---