php-general Digest 24 Jul 2013 12:19:21 -0000 Issue 8309

Topics (messages 321698 through 321703):

Re: /tmp/directory
        321698 by: Daniel Brown
        321702 by: Tedd Sperling

Re: How to extract php source code from joomla
        321699 by: Yoinier Hernandez Nieves
        321701 by: richard gray

Re: Foreach and mydql_query problem
        321700 by: Karl-Arne Gjersøyen

What wrong am I doing now?
        321703 by: Karl-Arne Gjersøyen

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 ---
On Mon, Jul 22, 2013 at 10:10 PM, Tedd Sperling <t...@sperling.com> wrote:
> 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.

    If it's /tmp, it's /tmp.  The leading slash indicates that it's in
the filesystem root.  However, if it's just tmp, then it could - and
probably is - under the client's home directory.  Unless they're
chrooted; then it could be displayed as /tmp, but would actually be
virtualized by the OS, where /tmp isn't really /tmp, but could be
/var/virtfs/user/tmp.

    Confusing?  Sure.  Off-topic for the list?  Sort of, but that's
easy enough to change.

    Since you can't use get_sys_temp_dir() on 4.3.10, you should
instead see if $_ENV contains an array key for TMP, TMPDIR, or TEMP.
Or, if you'd rather, you can use getenv('TMP') and the like.  It
doesn't mean that you'll get any useful information back (or anything
at all, necessarily), but it's another thing to try when using such an
antiquated version (I believe it was released at the end of 2004).

--
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/

--- End Message ---
--- Begin Message ---
On Jul 23, 2013, at 9:55 AM, Daniel Brown <danbr...@php.net> wrote:
>> 
> 
>    If it's /tmp, it's /tmp.  The leading slash indicates that it's in
> the filesystem root.  However, if it's just tmp, then it could - and
> probably is - under the client's home directory.  Unless they're
> chrooted; then it could be displayed as /tmp, but would actually be
> virtualized by the OS, where /tmp isn't really /tmp, but could be
> /var/virtfs/user/tmp.
> 
>    Confusing?  Sure.  Off-topic for the list?  Sort of, but that's
> easy enough to change.
> 
>    Since you can't use get_sys_temp_dir() on 4.3.10, you should
> instead see if $_ENV contains an array key for TMP, TMPDIR, or TEMP.
> Or, if you'd rather, you can use getenv('TMP') and the like.  It
> doesn't mean that you'll get any useful information back (or anything
> at all, necessarily), but it's another thing to try when using such an
> antiquated version (I believe it was released at the end of 2004).

Thanks Daniel.

tedd


_____________________
t...@sperling.com
http://sperling.com


--- End Message ---
--- Begin Message ---
El 22/07/13 15:49, elk dolk escribió:
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 .

You can use Prestashop, Magento, Oscommerce, etc, and modify at you're needed.

project Two : Implementing of a B2B sell-side portal with negotiation mechanism.

You can modify above softwares to this purpose.

Thanks
As I am familiar with php and My.SQL and I have only 20 days to complete those 
projects !  I thought it's
(...)

Thanks,
Ash
http://www.ashleysheridan.co.uk



--
_____.___.      .__
\__  |   | ____ |__| _______  __ ____   ______
 /   |   |/    \|  |/ __ \  \/ // __ \ /  ___/
 \____   |   |  \  \  ___/\   /\  ___/ \___ \
 / ______|___|  /__|\___  >\_/  \___  >____  >
 \/           \/        \/          \/     \/
    .___      __   _______          __
  __| _/_____/  |_ \      \   _____/  |_
 / __ |/  _ \   __\/   |   \_/ __ \   __\
/ /_/ (  <_> )  | /    |    \  ___/|  |
\____ |\____/|__| \____|__  /\___  >__|
     \/                   \/     \/

--- End Message ---
--- Begin Message ---
On 23/07/2013 16:54, Yoinier Hernandez Nieves wrote:
El 22/07/13 15:49, elk dolk escribió:
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 .

You can use Prestashop, Magento, Oscommerce, etc, and modify at you're needed.
IMO do NOT use Oscommerce (or the ZenCart fork for that matter) ... unless you want a lesson in how not to write an application in PHP... the code and architecture is (well it was the last time I had the dubious pleasure of working with it...) truly awful....

Rich

--- End Message ---
--- Begin Message ---
It works now and it was a php thing.When I combine a for and while loop
together with Limit in my query it works.
Karl

mandag 22. juli 2013 skrev Liam følgende:

> Shouldn't $_POST['number_of_itemsi'] be $_POST['number_of_items']
>
>
> Kind Regards,
>
> Liam.
> 3Sharp Ltd.
>
> T: 0845 6018370
> F: 0845 6018369
>
> -----Original Message-----
> From: Karl-Arne Gjersøyen [mailto:karlar...@gmail.com <javascript:;>]
> Sent: 22 July 2013 12:39
> To: PHP Mailinglist
> Subject: Re: [PHP] Foreach and mydql_query problem
>
> 2013/7/22 Tamara Temple <tamouse.li...@gmail.com <javascript:;>>
>
> >
> > On Jul 22, 2013, at 1:19 AM, Karl-Arne Gjersøyen 
> > <karlar...@gmail.com<javascript:;>
> >
> > 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 "$itemi<br>";
> > >
> > >            $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 "$kolli<br>";
>
>             //    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="top"><strong>Sprengstoff</strong>,<?php echo
> "$sprengstofftype"; ?></td>
>     <td align="left" valign="top"><?php echo "$varenavn"; ?></td>
>     <td align="left" valign="top"><strong>1.1D</strong></td>
>     <td align="left" valign="top">&nbsp;</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="top"><input 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="top"><strong>Sprengstoff</strong>,<?php echo
> "$sprengstofftype"; ?></td>
>     <td align="left" valign="top"><?php echo "$varenavn"; ?></td>
>     <td align="left" valign="top"><strong>1.1D</strong></td>
>     <td align="left" valign="top">&nbsp;</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="top"><input 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'];
>     }
>
> ?>
>


-- 
Hjemmeside: http://www.karl-arne.name/

--- End Message ---
--- Begin Message ---
mysql> SELECT DATE_FORMAT(dato, '%e-%c-%Y') FROM transportdokument WHERE
dato >= '2013-07-20' AND dato <= '2013-07-24' GROUP BY dato DESC;
+-------------------------------+
| DATE_FORMAT(dato, '%e-%c-%Y') |
+-------------------------------+
| 24-7-2013                     |
| 23-7-2013                     |
+-------------------------------+
2 rows in set (0.00 sec)

mysql>


// My PHP code looks like this.
// -----------------------------------------
$sql = "SELECT DATE_FORMAT(dato, '%e-%c-%Y') FROM transportdokument WHERE
dato >= '2013-07-20' AND dato <= '2013-07-24' GROUP BY dato DESC";
$resultat = mysql_query($sql, $tilkobling) or die(mysql_error());

while($rad = mysql_fetch_array($resultat)){
$dato = $rad['dato'];
var_dump($dato);

I gott NULL,NULL here and believe it is something with my PHP Source that
is wrong when using DATE_FORMAT. As you see above it work in terminal.

I hope this not is off-topic for the list. If so, I am sorry for it and
hope you can give me advice about a good MySQL list for newbie's.

Thanks again for your help!

Karl

--- End Message ---

Reply via email to