php-general Digest 22 Jul 2013 08:03:50 -0000 Issue 8306
php-general Digest 22 Jul 2013 08:03:50 - Issue 8306 Topics (messages 321666 through 321668): Foreach and mydql_query problem 321666 by: Karl-Arne Gjersøyen 321667 by: Tamara Temple 321668 by: Stuart Dallas 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 -- ---BeginMessage--- Hello again. I have this this source code that not work as I want... THe PHP/HTHML form fields is generated by a while loop and looks like this: input type=number name=number_of_items[] size=6 value=?hp echo $item; ? required=required the php source code look like this: ?php if(!empty($_POST['number_of_itemsi'])){ include('../../connect.php'); foreach($number_of_items as $itemi){ echo $itemibr; $sql = UPDATE item_table SET number_item = '$item' WHERE date = '$todays_date' AND sign = '$username'; mysql_query($sql,$connect) or die(mysql_error()); } } ? The problem is: Foreach list every items as expected in PHP doc and I thought that $sql and mysql_query should be run five times when I have five items. But the problem is that only the very last number_of_items is written when update the form.. I believe this is becayse number_of_items = '$item in $sqk override every earlier result. So my querstion is. How to to update the database in this case? Thanks again for your good advice and time to help me. Karl' ---End Message--- ---BeginMessage--- On Jul 22, 2013, at 1:19 AM, Karl-Arne Gjersøyen karlar...@gmail.com wrote: Hello again. I have this this source code that not work as I want... THe PHP/HTHML form fields is generated by a while loop and looks like this: input type=number name=number_of_items[] size=6 value=?hp echo $item; ? required=required the php source code look like this: ?php if(!empty($_POST['number_of_itemsi'])){ include('../../connect.php'); foreach($number_of_items as $itemi){ echo $itemibr; $sql = UPDATE item_table SET number_item = '$item' WHERE date = '$todays_date' AND sign = '$username'; mysql_query($sql,$connect) or die(mysql_error()); } } ? The problem is: Foreach list every items as expected in PHP doc and I thought that $sql and mysql_query should be run five times when I have five items. But the problem is that only the very last number_of_items is written when update the form.. I believe this is becayse number_of_items = '$item in $sqk override every earlier result. So my querstion is. How to to update the database in this case? Thanks again for your good advice and time to help me. Karl' Either the code you posted isn't the actual code, or if it is, the errors should be rather obvious. Post *actual* code. ---End Message--- ---BeginMessage--- On 22 Jul 2013, at 08:04, Tamara Temple tamouse.li...@gmail.com wrote: On Jul 22, 2013, at 1:19 AM, Karl-Arne Gjersøyen karlar...@gmail.com wrote: Hello again. I have this this source code that not work as I want... THe PHP/HTHML form fields is generated by a while loop and looks like this: input type=number name=number_of_items[] size=6 value=?hp echo $item; ? required=required the php source code look like this: ?php if(!empty($_POST['number_of_itemsi'])){ include('../../connect.php'); foreach($number_of_items as $itemi){ echo $itemibr; $sql = UPDATE item_table SET number_item = '$item' WHERE date = '$todays_date' AND sign = '$username'; mysql_query($sql,$connect) or die(mysql_error()); } } ? The problem is: Foreach list every items as expected in PHP doc and I thought that $sql and mysql_query should be run five times when I have five items. But the problem is that only the very last number_of_items is written when update the form.. I believe this is becayse number_of_items = '$item in $sqk override every earlier result. So my querstion is. How to to update the database in this case? Thanks again for your good advice and time to help me. Karl' Either the code you posted isn't the actual code, or if it is, the errors should be rather obvious. Post *actual* code. The error is rather obvious: it loops around an array running an update statement that will modify a single row in the table, so it's not surprising that it appears like only the last entry in the array has been stored. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/---End Message---
[PHP] Foreach and mydql_query problem
Hello again. I have this this source code that not work as I want... THe PHP/HTHML form fields is generated by a while loop and looks like this: input type=number name=number_of_items[] size=6 value=?hp echo $item; ? required=required the php source code look like this: ?php if(!empty($_POST['number_of_itemsi'])){ include('../../connect.php'); foreach($number_of_items as $itemi){ echo $itemibr; $sql = UPDATE item_table SET number_item = '$item' WHERE date = '$todays_date' AND sign = '$username'; mysql_query($sql,$connect) or die(mysql_error()); } } ? The problem is: Foreach list every items as expected in PHP doc and I thought that $sql and mysql_query should be run five times when I have five items. But the problem is that only the very last number_of_items is written when update the form.. I believe this is becayse number_of_items = '$item in $sqk override every earlier result. So my querstion is. How to to update the database in this case? Thanks again for your good advice and time to help me. Karl'
Re: [PHP] Foreach and mydql_query problem
On Jul 22, 2013, at 1:19 AM, Karl-Arne Gjersøyen karlar...@gmail.com wrote: Hello again. I have this this source code that not work as I want... THe PHP/HTHML form fields is generated by a while loop and looks like this: input type=number name=number_of_items[] size=6 value=?hp echo $item; ? required=required the php source code look like this: ?php if(!empty($_POST['number_of_itemsi'])){ include('../../connect.php'); foreach($number_of_items as $itemi){ echo $itemibr; $sql = UPDATE item_table SET number_item = '$item' WHERE date = '$todays_date' AND sign = '$username'; mysql_query($sql,$connect) or die(mysql_error()); } } ? The problem is: Foreach list every items as expected in PHP doc and I thought that $sql and mysql_query should be run five times when I have five items. But the problem is that only the very last number_of_items is written when update the form.. I believe this is becayse number_of_items = '$item in $sqk override every earlier result. So my querstion is. How to to update the database in this case? Thanks again for your good advice and time to help me. Karl' Either the code you posted isn't the actual code, or if it is, the errors should be rather obvious. Post *actual* code. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Foreach and mydql_query problem
On 22 Jul 2013, at 08:04, Tamara Temple tamouse.li...@gmail.com wrote: On Jul 22, 2013, at 1:19 AM, Karl-Arne Gjersøyen karlar...@gmail.com wrote: Hello again. I have this this source code that not work as I want... THe PHP/HTHML form fields is generated by a while loop and looks like this: input type=number name=number_of_items[] size=6 value=?hp echo $item; ? required=required the php source code look like this: ?php if(!empty($_POST['number_of_itemsi'])){ include('../../connect.php'); foreach($number_of_items as $itemi){ echo $itemibr; $sql = UPDATE item_table SET number_item = '$item' WHERE date = '$todays_date' AND sign = '$username'; mysql_query($sql,$connect) or die(mysql_error()); } } ? The problem is: Foreach list every items as expected in PHP doc and I thought that $sql and mysql_query should be run five times when I have five items. But the problem is that only the very last number_of_items is written when update the form.. I believe this is becayse number_of_items = '$item in $sqk override every earlier result. So my querstion is. How to to update the database in this case? Thanks again for your good advice and time to help me. Karl' Either the code you posted isn't the actual code, or if it is, the errors should be rather obvious. Post *actual* code. The error is rather obvious: it loops around an array running an update statement that will modify a single row in the table, so it's not surprising that it appears like only the last entry in the array has been stored. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and Powershell
Hi, Thanks for your change. I understand what has happend, from MSDN forums http://social.technet.microsoft.com/Forums/windowsserver/en-US/4b841530-9d8c-4d09-a77c-b89c6e0bafab/how-do-i-capture-data-from-invokecommand http://technet.microsoft.com/en-us/library/jj612804.aspx describes that Get-IscsiServerTarget returns an instance of Microsoft.Iscsi.Target.Commands.IscsiServerTarget. De output also includes the runspaceid and pscomputername. Invoke-Command also returns a runspaceid (when executed with -computername). You need to use Select-Object to output only the relevant fields instead. HTH Kind regards/met vriendelijke groet, Serge Fonville http://www.sergefonville.nl Convince Microsoft! They need to add TRUNCATE PARTITION in SQL Server https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table 2013/7/19 Alan Loos alan.l...@genco.com Serge, I have, the script itself allows for easy transition into a .ps1, what I have done is removed the # from the debug section to get the full command that is then easily ‘copy and paste’-able into a Powershell prompt and I get the same response in Powershell directly. Also in response to the lastest post to the thread I will snip off some content here. (Sorry first time at this) The ultimate goal is to pull the two variables so I can pass them forward via a PHP script to a MySQL Database. (ie iqn.2013-04.com.widget:Target1 and NotConnected in this case) I believe that the command in Powershell is trying to gather the $Status on both the Invoke-Command and Get-iSCSIServerTarget commands. Which is why I am getting a table in the Powershell Console and browser. Per your request I have rewritten the scripts: (Included inline) TestGetServerTarget.php -- ?php ### ## Variables ## ### $psCMD = powershell.exe -ExecutionPolicy Unrestricted; $psFILE = C:\\Arc\\scripts\\TestGetTarget.ps1; $runCMD = $psCMD. .$psFILE; ## Variable Checking (For Debug Mode) ## #echo \$psCMD = $psCMD; ## Run Script ## exec($runCMD, $out); ## Output ## echo ('pre'); print_r($out); echo ('/pre'); ### ## End Of Script ## ### echo End Of Scene; ? -- TestGetTarget.ps1 -- ### ## Variables ## ### $cred = New-Object System.Management.Automation.PSCredential -ArgumentList @('administra...@widget.com',(ConvertTo-SecureString -String 'MyPassword' -AsPlainText -Force)) $command = Invoke-Command -computername localhost -credential $cred -scriptblock { Get-IscsiServerTarget -TargetName Target1 | % { $_.TargetIqn, $_.Status}} -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck) # ## Execute Scriptblock ## # $command -- Powershell output of TestGetTarget.ps1: -- PS C:\Arc\Scripts .\TestGetTarget.ps1 iqn.2013-04.com.widget:Target1 PSComputerName RunspaceId Value -- -- - localhost f3c5063a-85df-49a3-a5ed-7df04a930684NotConnected -- PHP output webbrowser (Much in the same): -- Array ( [0] = iqn.2013-04.com.widget:Target1 [1] = [2] = PSComputerName RunspaceId Value [3] = -- -- - [4] = localhost f46c9f15-70b4-496c-a9d6... NotConnected [5] = [6] = ) End Of Scene -- *Alan Loos* 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. *From:* Serge Fonville [mailto:serge.fonvi...@gmail.com] *Sent:* Friday, July 19, 2013 12:16 PM *To:* Alan Loos *Cc:* php-general@lists.php.net *Subject:* Re: [PHP] PHP and Powershell Thank you for your clarification. Have you considered placing the whole powershell -command parameter in a .ps1 script and executing that instead? The benefit would be that it is easier to read and test accordingly. HTH Kind regards/met vriendelijke groet,
Re: [PHP] Foreach and mydql_query problem
2013/7/22 Tamara Temple tamouse.li...@gmail.com On Jul 22, 2013, at 1:19 AM, Karl-Arne Gjersøyen karlar...@gmail.com wrote: Hello again. I have this this source code that not work as I want... THe PHP/HTHML form fields is generated by a while loop and looks like this: input type=number name=number_of_items[] size=6 value=?hp echo $item; ? required=required the php source code look like this: ?php if(!empty($_POST['number_of_itemsi'])){ include('../../connect.php'); foreach($number_of_items as $itemi){ echo $itemibr; $sql = UPDATE item_table SET number_item = '$item' WHERE date = '$todays_date' AND sign = '$username'; mysql_query($sql,$connect) or die(mysql_error()); } } ? The problem is: Foreach list every items as expected in PHP doc and I thought that $sql and mysql_query should be run five times when I have five items. But the problem is that only the very last number_of_items is written when update the form.. I believe this is becayse number_of_items = '$item in $sqk override every earlier result. So my querstion is. How to to update the database in this case? Thanks again for your good advice and time to help me. Karl' Either the code you posted isn't the actual code, or if it is, the errors should be rather obvious. Post *actual* code. // The acutual source code is below: // == if(!empty($_POST['antall_kolli'])){ include('../../tilkobling.php'); foreach($antall_kolli as $kolli){ echo $kollibr; //echo $kolli. br; $sql = UPDATE transportdokument SET antall_kolli_stk = '$kolli' WHERE dato = '$dagens_dato' AND signatur = '$brukernavn'; mysql_query($sql,$tilkobling) or die(mysql_error()); } } // THE PHP/HTML Form below: include('../../tilkobling.php'); $sql = SELECT * FROM transportdokument WHERE dato = '$dagens_dato' AND signatur = '$brukernavn'; $resultat = mysql_query($sql, $tilkobling) or die(mysql_error()); while($rad = mysql_fetch_array($resultat, MYSQL_ASSOC)){ $valgt_lager = $rad['valgt_lager']; $un_nr = $rad['un_nr']; $sprengstofftype = $rad['sprengstofftype']; $varenavn = $rad['varenavn']; $varenr = $rad['varenr']; $antall_kolli = $rad['antall_kolli_stk']; $adr_vekt_kg = $rad['adr_vekt_kg']; $varenavn = $rad['varenavn']; $emb = $rad['emb']; ? tr td align=left valign=top?php echo $un_nr; ?/td td align=left valign=topstrongSprengstoff/strong,?php echo $sprengstofftype; ?/td td align=left valign=top?php echo $varenavn; ?/td td align=left valign=topstrong1.1D/strong/td td align=left valign=topnbsp;/td td align=left valign=top?php echo $emb; ?/td td align=left valign=top input type=hidden name=varenr[] value=?php echo $varenr; ? input type=number name=antall_kolli[] size=6 value=?php echo $antall_kolli; ? required=required /td td align=left valign=topinput type=text name=exan_kg_ut[] size=6 value=?php echo $adr_vekt_kg; ? required=required/td /tr ?php $total_mengde_kg_adr += $rad['adr_vekt_kg']; $total_antall_kolli += $rad['antall_kolli_stk']; } ? include('../../tilkobling.php'); $sql = SELECT * FROM transportdokument WHERE dato = '$dagens_dato' AND signatur = '$brukernavn'; $resultat = mysql_query($sql, $tilkobling) or die(mysql_error()); while($rad = mysql_fetch_array($resultat, MYSQL_ASSOC)){ $valgt_lager = $rad['valgt_lager']; $un_nr = $rad['un_nr']; $sprengstofftype = $rad['sprengstofftype']; $varenavn = $rad['varenavn']; $varenr = $rad['varenr']; $antall_kolli = $rad['antall_kolli_stk']; $adr_vekt_kg = $rad['adr_vekt_kg']; $varenavn = $rad['varenavn']; $emb = $rad['emb']; ? tr td align=left valign=top?php echo $un_nr; ?/td td align=left valign=topstrongSprengstoff/strong,?php echo $sprengstofftype; ?/td td align=left valign=top?php echo $varenavn; ?/td td align=left valign=topstrong1.1D/strong/td td align=left valign=topnbsp;/td td align=left valign=top?php echo $emb; ?/td td align=left valign=top input type=hidden name=varenr[] value=?php echo $varenr; ? input type=number name=antall_kolli[] size=6 value=?php echo $antall_kolli; ? required=required /td td align=left valign=topinput type=text name=exan_kg_ut[] size=6 value=?php echo $adr_vekt_kg; ? required=required/td /tr ?php $total_mengde_kg_adr += $rad['adr_vekt_kg']; $total_antall_kolli += $rad['antall_kolli_stk']; } ?
Re: [PHP] Foreach and mydql_query problem
2013/7/22 Stuart Dallas stu...@3ft9.com On 22 Jul 2013, at 08:04, Tamara Temple tamouse.li...@gmail.com wrote: On Jul 22, 2013, at 1:19 AM, Karl-Arne Gjersøyen karlar...@gmail.com wrote: Hello again. I have this this source code that not work as I want... THe PHP/HTHML form fields is generated by a while loop and looks like this: input type=number name=number_of_items[] size=6 value=?hp echo $item; ? required=required the php source code look like this: ?php if(!empty($_POST['number_of_itemsi'])){ include('../../connect.php'); foreach($number_of_items as $itemi){ echo $itemibr; $sql = UPDATE item_table SET number_item = '$item' WHERE date = '$todays_date' AND sign = '$username'; mysql_query($sql,$connect) or die(mysql_error()); } } ? The problem is: Foreach list every items as expected in PHP doc and I thought that $sql and mysql_query should be run five times when I have five items. But the problem is that only the very last number_of_items is written when update the form.. I believe this is becayse number_of_items = '$item in $sqk override every earlier result. So my querstion is. How to to update the database in this case? Thanks again for your good advice and time to help me. Karl' Either the code you posted isn't the actual code, or if it is, the errors should be rather obvious. Post *actual* code. The error is rather obvious: it loops around an array running an update statement that will modify a single row in the table, so it's not surprising that it appears like only the last entry in the array has been stored. Yes, i know that only one a singe row is updated and that is the problem. What can I do to update several rows at the same time? Thank you very much for all your good adivce. Karl
[PHP] Re: Foreach and mydql_query problem
On 22 Jul 2013 at 12:56, Karl-Arne Gjersøyen karlar...@gmail.com wrote: Yes, i know that only one a singe row is updated and that is the problem. What can I do to update several rows at the same time? Which several rows? The row that will be updated is that (or those) that match your WHERE clause. Seems to me you should make sure your WHERE is correct. -- Cheers -- Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Foreach and mydql_query problem
On 22 Jul 2013, at 12:56, Karl-Arne Gjersøyen karlar...@gmail.com wrote: 2013/7/22 Stuart Dallas stu...@3ft9.com On 22 Jul 2013, at 08:04, Tamara Temple tamouse.li...@gmail.com wrote: On Jul 22, 2013, at 1:19 AM, Karl-Arne Gjersøyen karlar...@gmail.com wrote: Hello again. I have this this source code that not work as I want... THe PHP/HTHML form fields is generated by a while loop and looks like this: input type=number name=number_of_items[] size=6 value=?hp echo $item; ? required=required the php source code look like this: ?php if(!empty($_POST['number_of_itemsi'])){ include('../../connect.php'); foreach($number_of_items as $itemi){ echo $itemibr; $sql = UPDATE item_table SET number_item = '$item' WHERE date = '$todays_date' AND sign = '$username'; mysql_query($sql,$connect) or die(mysql_error()); } } ? The problem is: Foreach list every items as expected in PHP doc and I thought that $sql and mysql_query should be run five times when I have five items. But the problem is that only the very last number_of_items is written when update the form.. I believe this is becayse number_of_items = '$item in $sqk override every earlier result. So my querstion is. How to to update the database in this case? Thanks again for your good advice and time to help me. Karl' Either the code you posted isn't the actual code, or if it is, the errors should be rather obvious. Post *actual* code. The error is rather obvious: it loops around an array running an update statement that will modify a single row in the table, so it's not surprising that it appears like only the last entry in the array has been stored. Yes, i know that only one a singe row is updated and that is the problem. What can I do to update several rows at the same time? Thank you very much for all your good advice. Are you sure you want to update several rows, or do you actually want to insert several rows? This is pretty basic database stuff, and is off-topic for this list. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Foreach and mydql_query problem
2013/7/22 Tim Streater t...@clothears.org.uk On 22 Jul 2013 at 12:56, Karl-Arne Gjersøyen karlar...@gmail.com wrote: Yes, i know that only one a singe row is updated and that is the problem. What can I do to update several rows at the same time? Which several rows? The row that will be updated is that (or those) that match your WHERE clause. Seems to me you should make sure your WHERE is correct. Thanks, Tim. Yes the form is generated in a while loop and have input type=number name=number_of_items[] size=6 value=?php echo $item; ?. This field is in several product rows and when I update the form the foreach loop write all (5) products correct. But the other way: Update actual rows in the database did not work. Only the latest row is updated.. Karl
Re: [PHP] Foreach and mydql_query problem
2013/7/22 Stuart Dallas stu...@3ft9.com On 22 Jul 2013, at 12:56, Karl-Arne Gjersøyen karlar...@gmail.com wrote: 2013/7/22 Stuart Dallas stu...@3ft9.com On 22 Jul 2013, at 08:04, Tamara Temple tamouse.li...@gmail.com wrote: On Jul 22, 2013, at 1:19 AM, Karl-Arne Gjersøyen karlar...@gmail.com wrote: Hello again. I have this this source code that not work as I want... THe PHP/HTHML form fields is generated by a while loop and looks like this: input type=number name=number_of_items[] size=6 value=?hp echo $item; ? required=required the php source code look like this: ?php if(!empty($_POST['number_of_itemsi'])){ include('../../connect.php'); foreach($number_of_items as $itemi){ echo $itemibr; $sql = UPDATE item_table SET number_item = '$item' WHERE date = '$todays_date' AND sign = '$username'; mysql_query($sql,$connect) or die(mysql_error()); } } ? The problem is: Foreach list every items as expected in PHP doc and I thought that $sql and mysql_query should be run five times when I have five items. But the problem is that only the very last number_of_items is written when update the form.. I believe this is becayse number_of_items = '$item in $sqk override every earlier result. So my querstion is. How to to update the database in this case? Thanks again for your good advice and time to help me. Karl' Either the code you posted isn't the actual code, or if it is, the errors should be rather obvious. Post *actual* code. The error is rather obvious: it loops around an array running an update statement that will modify a single row in the table, so it's not surprising that it appears like only the last entry in the array has been stored. Yes, i know that only one a singe row is updated and that is the problem. What can I do to update several rows at the same time? Thank you very much for all your good advice. Are you sure you want to update several rows, or do you actually want to insert several rows? This is pretty basic database stuff, and is off-topic for this list. OK. Sorry. I thought it was a PHP question for a way to update several mysql rows by PHP code. Karl
Re: [PHP] Foreach and mydql_query problem
On 22 Jul 2013, at 13:25, Karl-Arne Gjersøyen karlar...@gmail.com wrote: 2013/7/22 Stuart Dallas stu...@3ft9.com On 22 Jul 2013, at 12:56, Karl-Arne Gjersøyen karlar...@gmail.com wrote: 2013/7/22 Stuart Dallas stu...@3ft9.com On 22 Jul 2013, at 08:04, Tamara Temple tamouse.li...@gmail.com wrote: On Jul 22, 2013, at 1:19 AM, Karl-Arne Gjersøyen karlar...@gmail.com wrote: Hello again. I have this this source code that not work as I want... THe PHP/HTHML form fields is generated by a while loop and looks like this: input type=number name=number_of_items[] size=6 value=?hp echo $item; ? required=required the php source code look like this: ?php if(!empty($_POST['number_of_itemsi'])){ include('../../connect.php'); foreach($number_of_items as $itemi){ echo $itemibr; $sql = UPDATE item_table SET number_item = '$item' WHERE date = '$todays_date' AND sign = '$username'; mysql_query($sql,$connect) or die(mysql_error()); } } ? The problem is: Foreach list every items as expected in PHP doc and I thought that $sql and mysql_query should be run five times when I have five items. But the problem is that only the very last number_of_items is written when update the form.. I believe this is becayse number_of_items = '$item in $sqk override every earlier result. So my querstion is. How to to update the database in this case? Thanks again for your good advice and time to help me. Karl' Either the code you posted isn't the actual code, or if it is, the errors should be rather obvious. Post *actual* code. The error is rather obvious: it loops around an array running an update statement that will modify a single row in the table, so it's not surprising that it appears like only the last entry in the array has been stored. Yes, i know that only one a singe row is updated and that is the problem. What can I do to update several rows at the same time? Thank you very much for all your good advice. Are you sure you want to update several rows, or do you actually want to insert several rows? This is pretty basic database stuff, and is off-topic for this list. OK. Sorry. I thought it was a PHP question for a way to update several mysql rows by PHP code. If you want to UPDATE several rows then you must have unique identifiers for those rows. If you don't then I'm guessing what you actually want to do is INSERT those rows. It's off-topic in the same way as asking a mechanic how to fit a bunch of stuff in your car. It's the MySQL part that you're having a problem with, not the PHP. I strongly recommend that you use the MySQL command line to run the queries you think you need to run, checking what the table looks like after each one. Once you know what queries you need to run you will more effectively be able to write the PHP wrapper around those queries. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] /tmp/directory
On Jul 22, 2013, at 11:20 AM, Tedd Sperling t...@sperling.com wrote Hi gang: I should know this, but I don't. Where is the /tmp/ directory? You see, I have a client where his host has apparently changed the /tmp/ directory permissions such that old php/mysql scripts cannot write to the /tmp/ directory anymore -- they did at one time. So, how do I fix it? Cheers, tedd Let me add -- the PHP version I am working with is 4.3.10. I know... 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] /tmp/directory
At 11:50 AM 7/22/2013, Tedd Sperling wrote: On Jul 22, 2013, at 11:20 AM, Tedd Sperling t...@sperling.com wrote Hi gang: I should know this, but I don't. Where is the /tmp/ directory? You see, I have a client where his host has apparently changed the /tmp/ directory permissions such that old php/mysql scripts cannot write to the /tmp/ directory anymore -- they did at one time. So, how do I fix it? Cheers, tedd Let me add -- the PHP version I am working with is 4.3.10. I know... tedd The version of PHP should have nothing to do with this problem. The /tmp directory should be writable by everyone. If it's not, you need to talk to the hosting company support people. Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] /tmp/directory
On Mon, Jul 22, 2013 at 9:59 AM, Larry Martell la...@software-horizons.com wrote: On Mon, Jul 22, 2013 at 9:50 AM, Tedd Sperling tedd.sperl...@gmail.com wrote: On Jul 22, 2013, at 11:20 AM, Tedd Sperling t...@sperling.com wrote Hi gang: I should know this, but I don't. Where is the /tmp/ directory? You see, I have a client where his host has apparently changed the /tmp/ directory permissions such that old php/mysql scripts cannot write to the /tmp/ directory anymore -- they did at one time. So, how do I fix it? Cheers, tedd Let me add -- the PHP version I am working with is 4.3.10. I know... df /tmp should show you where it's mounted. And sys_get_temp_dir() will tell you the path. # php ? print sys_get_temp_dir() ? /tmp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] /tmp/directory
Hi gang: I should know this, but I don't. Where is the /tmp/ directory? You see, I have a client where his host has apparently changed the /tmp/ directory permissions such that old php/mysql scripts cannot write to the /tmp/ directory anymore -- they did at one time. So, how do I fix it? 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] Foreach and mydql_query problem
Your original code snippet had some errors. It really couldn't have been what you wanted to do. Example: You have a named field of 'number_of_items' and then you try to retreive $_POST['number_of_itemsi']. That won't work. Then you have a var called $number_of_items which we don't see defined, and you are assigning each to $itemi but then you use $item in your query. Very Confusing!! Perhaps if you clean up the errors you might see better results. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP and Powershell
Serge, Won't lie, read this from my phone this morning and thought 'No it can't be that easy'. Now that I'm at work in front of a computer I've updated the command to the following: GetTarget.ps1 ### ## Variables ## ### $cred = New-Object System.Management.Automation.PSCredential -ArgumentList @('administra...@widget.com',(ConvertTo-SecureString -String 'MyPassword' -AsPlainText -Force)) $command = Invoke-Command -computername localhost -credential $cred -scriptblock { Get-IscsiServerTarget -TargetName Target1 | select-object TargetIqn,Status | Format-List} -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck) # ## Execute Scriptblock ## # $command And it returns: Array ( [0] = [1] = [2] = TargetIqn : iqn.2013-04.com.widget:Target1 [3] = Status: NotConnected [4] = [5] = [6] = ) 0 End Of Scene In effect, you're a genius! Thank you for all your help I should be able to tackle it from here! Alan Loos 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. From: Serge Fonville [mailto:serge.fonvi...@gmail.com] Sent: Monday, July 22, 2013 4:09 AM To: Alan Loos Cc: php-general@lists.php.net Subject: Re: [PHP] PHP and Powershell Hi, Thanks for your change. I understand what has happend, from MSDN forums http://social.technet.microsoft.com/Forums/windowsserver/en-US/4b841530-9d8c-4d09-a77c-b89c6e0bafab/how-do-i-capture-data-from-invokecommand http://technet.microsoft.com/en-us/library/jj612804.aspx describes that Get-IscsiServerTarget returns an instance of Microsoft.Iscsi.Target.Commands.IscsiServerTarget. De output also includes the runspaceid and pscomputername. Invoke-Command also returns a runspaceid (when executed with -computername). You need to use Select-Object to output only the relevant fields instead. HTH Kind regards/met vriendelijke groet, Serge Fonville http://www.sergefonville.nl Convince Microsoft! They need to add TRUNCATE PARTITION in SQL Server https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table --Snip-- --Big Snip-- Please make note of my new email address: alan.l...@genco.com.
Re: [PHP] /tmp/directory
On Jul 22, 2013, at 12:02 PM, Larry Martell la...@software-horizons.com wrote: On Mon, Jul 22, 2013 at 9:59 AM, Larry Martell la...@software-horizons.com wrote: On Mon, Jul 22, 2013 at 9:50 AM, Tedd Sperling tedd.sperl...@gmail.com wrote: On Jul 22, 2013, at 11:20 AM, Tedd Sperling t...@sperling.com wrote I should know this, but I don't. Where is the /tmp/ directory? Let me add -- the PHP version I am working with is 4.3.10. I know... df /tmp should show you where it's mounted. And sys_get_temp_dir() will tell you the path. # php ? print sys_get_temp_dir() ? One might think that -- but no. The version is dated. 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] /tmp/directory
On Mon, Jul 22, 2013 at 9:50 AM, Tedd Sperling tedd.sperl...@gmail.com wrote: On Jul 22, 2013, at 11:20 AM, Tedd Sperling t...@sperling.com wrote Hi gang: I should know this, but I don't. Where is the /tmp/ directory? You see, I have a client where his host has apparently changed the /tmp/ directory permissions such that old php/mysql scripts cannot write to the /tmp/ directory anymore -- they did at one time. So, how do I fix it? Cheers, tedd Let me add -- the PHP version I am working with is 4.3.10. I know... df /tmp should show you where it's mounted. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Foreach and mydql_query problem
On 07/22/2013 04:39 AM, Karl-Arne Gjersøyen wrote: Might I suggest that you place your include for ../../tilkobling.php at the very top of this page? It would save you from possibly including it twice. // The acutual source code is below: // == if(!empty($_POST['antall_kolli'])){ include('../../tilkobling.php'); --- remove this line foreach($antall_kolli as $kolli){ echo $kollibr; //echo $kolli. br; $sql = UPDATE transportdokument SET antall_kolli_stk = '$kolli' WHERE dato = '$dagens_dato' AND signatur = '$brukernavn'; mysql_query($sql,$tilkobling) or die(mysql_error()); } Your WHERE conditions are the same, that is why it is updating a single row. Where are $dagens_dato and $brukernavn being defined? As others have stated, you need to include a unique identifier in your query so your query updates a specific record. } // THE PHP/HTML Form below: include('../../tilkobling.php'); --- move this to the top of the script $sql = SELECT * FROM transportdokument WHERE dato = '$dagens_dato' AND signatur = '$brukernavn'; $resultat = mysql_query($sql, $tilkobling) or die(mysql_error()); while($rad = mysql_fetch_array($resultat, MYSQL_ASSOC)){ $valgt_lager = $rad['valgt_lager']; $un_nr = $rad['un_nr']; $sprengstofftype = $rad['sprengstofftype']; $varenavn = $rad['varenavn']; $varenr = $rad['varenr']; $antall_kolli = $rad['antall_kolli_stk']; $adr_vekt_kg = $rad['adr_vekt_kg']; $varenavn = $rad['varenavn']; $emb = $rad['emb']; ? tr td align=left valign=top?php echo $un_nr; ?/td td align=left valign=topstrongSprengstoff/strong,?php echo $sprengstofftype; ?/td td align=left valign=top?php echo $varenavn; ?/td td align=left valign=topstrong1.1D/strong/td td align=left valign=topnbsp;/td td align=left valign=top?php echo $emb; ?/td td align=left valign=top input type=hidden name=varenr[] value=?php echo $varenr; ? input type=number name=antall_kolli[] size=6 value=?php echo $antall_kolli; ? required=required /td td align=left valign=topinput type=text name=exan_kg_ut[] size=6 value=?php echo $adr_vekt_kg; ? required=required/td /tr ?php $total_mengde_kg_adr += $rad['adr_vekt_kg']; $total_antall_kolli += $rad['antall_kolli_stk']; } ? -- Jim Lucas http://www.cmsws.com/ http://www.cmsws.com/examples/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] /tmp/directory
On Jul 22, 2013, at 10:20 AM, Tedd Sperling t...@sperling.com wrote: Hi gang: I should know this, but I don't. Where is the /tmp/ directory? You see, I have a client where his host has apparently changed the /tmp/ directory permissions such that old php/mysql scripts cannot write to the /tmp/ directory anymore -- they did at one time. So, how do I fix it? 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 This is one of those questions I look at sideways and think they did WH??? Anyway, /tmp is under / on most linux systems, /private/tmp sometimes; I've encountered one system where it linked to /var/tmp, too. Try: $ /bin/ls -ld /tmp and see what it shows. -l is long listing, which will show permissions, if it's symlinked, etc. -d will treat /tmp as a file rather than as a directory (which would show the contents of /tmp). Hopefully, they didn't delete the /tmp directory; but if they had, *many* things would probably stop working…. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to extract php source code from joomla
Hi all, I want to build a website using Joomla 2.5 . It should have 5 pages: index.php pageOne.php pageTwo.php ... How can I get the php source code for those pages? I installed joomla 2.5 on my windows box and use XAMPP's appache web server thanks
Re: [PHP] How to extract php source code from joomla
On Mon, 2013-07-22 at 12:18 -0700, elk dolk wrote: Hi all, I want to build a website using Joomla 2.5 . It should have 5 pages: index.php pageOne.php pageTwo.php ... How can I get the php source code for those pages? I installed joomla 2.5 on my windows box and use XAMPP's appache web server thanks Erm, Joomla is a CMS, which means that you don't have source code for individual pages like that. If you want, you don't have to get involved with the PHP at all in Joomla. What is it that you're actually trying to achieve? Thanks, Ash http://www.ashleysheridan.co.uk
[PHP] How to extract php source code from joomla
Thank you for the quick response ! What I am trying to do : I have to complete two university projects for my professor ! project One : Make an online shop and must use the following components in it Shopping cart, Catalog of products, payment gateway , user login and user activity log . project Two : Implementing of a B2B sell-side portal with negotiation mechanism. As I am familiar with php and My.SQL and I have only 20 days to complete those projects ! I thought it's better to use Joomla I'll be grateful if you can give me an advice thank you - Forwarded Message - From: Ashley Sheridan a...@ashleysheridan.co.uk To: elk dolk elkd...@yahoo.com Cc: php-general@lists.php.net php-general@lists.php.net Sent: Monday, July 22, 2013 11:45 PM Subject: Re: [PHP] How to extract php source code from joomla On Mon, 2013-07-22 at 12:18 -0700, elk dolk wrote: Hi all, I want to build a website using Joomla 2.5 . It should have 5 pages: index.php pageOne.php pageTwo.php ... How can I get the php source code for those pages? I installed joomla 2.5 on my windows box and use XAMPP's appache web server thanks Erm, Joomla is a CMS, which means that you don't have source code for individual pages like that. If you want, you don't have to get involved with the PHP at all in Joomla. What is it that you're actually trying to achieve? Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] How to extract php source code from joomla
On Mon, 2013-07-22 at 12:49 -0700, elk dolk wrote: Thank you for the quick response ! What I am trying to do : I have to complete two university projects for my professor ! project One : Make an online shop and must use the following components in it Shopping cart, Catalog of products, payment gateway , user login and user activity log . project Two : Implementing of a B2B sell-side portal with negotiation mechanism. As I am familiar with php and My.SQL and I have only 20 days to complete those projects ! I thought it's better to use Joomla I'll be grateful if you can give me an advice thank you - Forwarded Message - From: Ashley Sheridan a...@ashleysheridan.co.uk To: elk dolk elkd...@yahoo.com Cc: php-general@lists.php.net php-general@lists.php.net Sent: Monday, July 22, 2013 11:45 PM Subject: Re: [PHP] How to extract php source code from joomla On Mon, 2013-07-22 at 12:18 -0700, elk dolk wrote: Hi all, I want to build a website using Joomla 2.5 . It should have 5 pages: index.php pageOne.php pageTwo.php ... How can I get the php source code for those pages? I installed joomla 2.5 on my windows box and use XAMPP's appache web server thanks Erm, Joomla is a CMS, which means that you don't have source code for individual pages like that. If you want, you don't have to get involved with the PHP at all in Joomla. What is it that you're actually trying to achieve? Thanks, Ash http://www.ashleysheridan.co.uk 20 days seems awfully ambitious, does your professor expect you to code these by hand or are you allowed to use an existing CMS, I ask because your original question seemed a bit odd. For e-commerce you're better off choosing a CMS which does that out of the box. Joomla has plugins that allow you to do these things, but it can be a hefty CMS, and it's not particularly suited for shops, plus it has a bit of a learning curve and some large security holes (which I know first hand having had to just get a Joomla site to pass a rigorous security test) Lastly, please try not to top post :) Thanks, Ash http://www.ashleysheridan.co.uk
[PHP] How to extract php source code from joomla
I am allowed to use tools or code by hand , it does not matter ,the professor wants to have the source code.
Re: [PHP] /tmp/directory
On Mon, Jul 22, 2013 at 5:20 PM, Tedd Sperling t...@sperling.com wrote: Hi gang: I should know this, but I don't. Where is the /tmp/ directory? You see, I have a client where his host has apparently changed the /tmp/ directory permissions such that old php/mysql scripts cannot write to the /tmp/ directory anymore -- they did at one time. So, how do I fix it? Cheers, tedd Switch host? /tmp is required by the FHS and POSIX standards (writable for any user), any host changing that should have no customers. - Matijn
Re: [PHP] How to extract php source code from joomla
On Mon, 2013-07-22 at 13:10 -0700, elk dolk wrote: I am allowed to use tools or code by hand , it does not matter ,the professor wants to have the source code. You say tools, but would he consider a full-blown complex CMS as merely a tool, or not? At this point, I agree, your best option is probably a CMS with plugins, because 20 days is not much time to build that sort of thing, and that's coming from someone who develops in PHP for a living. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] /tmp/directory
On Jul 22, 2013, at 4:10 PM, Matijn Woudt tijn...@gmail.com wrote: On Mon, Jul 22, 2013 at 5:20 PM, Tedd Sperling t...@sperling.com wrote: Hi gang: I should know this, but I don't. Where is the /tmp/ directory? You see, I have a client where his host has apparently changed the /tmp/ directory permissions such that old php/mysql scripts cannot write to the /tmp/ directory anymore -- they did at one time. So, how do I fix it? Cheers, tedd Switch host? /tmp is required by the FHS and POSIX standards (writable for any user), any host changing that should have no customers. - Matijn Good point -- we will add that reason to the many other reasons why we are changing host. Keep in mind, the installed software worked for nearly a decade and now the host has changed something that caused this error, but the current host doesn't seem to know what happened. 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] How to extract php source code from joomla
On Jul 22, 2013, at 3:49 PM, elk dolk elkd...@yahoo.com wrote: Thank you for the quick response ! What I am trying to do : I have to complete two university projects for my professor ! project One : Make an online shop and must use the following components in it Shopping cart, Catalog of products, payment gateway , user login and user activity log . project Two : Implementing of a B2B sell-side portal with negotiation mechanism. As I am familiar with php and My.SQL and I have only 20 days to complete those projects ! I thought it's better to use Joomla I'll be grateful if you can give me an advice thank you Sounds more like a client than someone who teaches php. I couldn't do that from scratch in 20 days and I teach php at college level. That's more than my entire 16 weeks course of introductory php. Are you in an advanced class? 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
[PHP] How to extract php source code from joomla
I study for MSc degree at university. Are you in an advanced class?