php-general Digest 17 Nov 2007 09:54:26 -0000 Issue 5133

Topics (messages 264727 through 264738):

Re: Loop issues
        264727 by: Jim Lucas
        264728 by: Jim Lucas

Re: Open Source BTS?? -- Roach
        264729 by: Daevid Vincent
        264732 by: David Calkins

Re: Open Source BTS??
        264730 by: Daevid Vincent

Re: IDE
        264731 by: Larry Garfield

Re: PHP editor
        264733 by: Cem Kayali
        264734 by: Cem Kayali
        264735 by: Cem Kayali

Re: [NEWBIE GUIDE] For the benefit of new members
        264736 by: Andrew Ballard
        264738 by: Cem Kayali

bank query and curl
        264737 by: Ronald Wiplinger

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Dan Shirah wrote:
Hello all,

I am having trouble trying to figure out how I should compose this loop to
give me ALL the results I want.

Below are my queries.  I am querying two different databases to pull in
records that match the requested $id. I am then putting the result into a
$variable and also counting the number of rows returned. These queries work
just fine and pull in all of the data that I want...and by viewing the
print_r() I have verified that all the information was returned.

<?php
$get_cs = "SELECT DISTINCT
      request_type, card_id, first_name, last_name
       FROM
         support_payment_request
       WHERE
         card_id = '$id'";
    $cs_type = mssql_query($get_cs) or die(mssql_get_last_message());
    $cs_num = mssql_num_rows($cs_type);

    if($cs_num > 0) {
   while ($cs_row = mssql_fetch_array($cs_type)) {
    $cs_type2 = $cs_row['request_type'];
    $cs_first = $cs_row['first_name'];
    $cs_last = $cs_row['last_name'];
    $cs_name = $cs_first." ".$cs_last;
     print_r ($cs_row);
    }
   }
$get_tr = "SELECT DISTINCT
      request_type, card_id, first_name, last_name
       FROM
         payment_request
       WHERE
         card_id = '$id'";
    $tr_type = mssql_query($get_tr) or die(mssql_get_last_message());
    $tr_num = mssql_num_rows($tr_type);

    if($tr_num > 0) {
   while ($tr_row = mssql_fetch_array($tr_type)) {
    $tr_type2 = $tr_row['request_type'];
    $tr_first = $tr_row['first_name'];
    $tr_last = $tr_row['last_name'];
    $tr_name = $tr_first." ".$tr_last;
     print_r ($tr_row);
    }
   }
$num_total = $cs_num + $tr_num;
$multiple = "MULTIPLE";
?>

Here is where I am running into problems. First I am writing an if ()
statement to see if there were any rows returned from the queries.  If a row
was returned I am echoing out the data that was assigned to the different
variables above.  This works...kind of...

 <td width='89' height='13' align='center' class='tblcell'><div
align='center'><?php echo "<a href='javascript:editRecord($id)'>$id</a>";
?></div></td>
<td width='172' height='13' align='center' class='tblcell'><div
align='center'><?php if ($cs_num > 0) { echo "$cs_name<br />\n"; }
                      if ($tr_num > 0) { echo "$tr_name<br />\n";
} ?></div></td>
<td width='201' height='13' align='center' class='tblcell'><div
align='center'><?php echo "$dateTime"; ?></div></td>
<td width='158' height='13' align='center' class='tblcell'><div
align='center'><?php if ($num_total > 1) { echo $multiple; }
                      if ($num_total == 1 && $cs_num == 1) { echo $cs_type2;
}
                      if ($num_total == 1 && $tr_num == 1) { echo $tr_type2;
} ?></div></td>
<td width='160' height='13' align='center' class='tblcell'><div
align='center'><?php echo "$last_processed_by"; ?></div></td>

If a single row was returned by the query, all of the information echos out
just fine.  BUT, If one of the queries returned more than one row, the
information that is echo'd out is only the LAST row's information. For
example, the result of my $cs_type query returns 3 names: John Smith, Jane
Smith, James Smith.  The only information being populated to my table is
James Smith.  Because of this I think I need to put a loop where the echo
"$cs_name<br />\n"; is so it will loop through all of the returned names and
show them all.  I have tried a for, foreach and while loop but I just can't
seem to wrap my fingers around the right way to use it.

Any help is appreciated.

Thanks,
Dan

What about something like this?

<?php

$records = array();

$SQL = "SELECT     DISTINCT request_type,
                card_id,
                first_name,
                last_name
        FROM    support_payment_request
        WHERE   card_id = '$id'";

$cs_type = mssql_query($SQL) or die(mssql_get_last_message());

if ( $cs_type ) {
        while ($records[] = $record = mssql_fetch_array($cs_type)) {
                print_r ($record);
        }
}

$SQL = "SELECT     DISTINCT request_type,
                card_id,
                first_name,
                last_name
        FROM    payment_request
        WHERE   card_id = '$id'";
$tr_type = mssql_query($get_tr) or die(mssql_get_last_message());

if ( $tr_type ) {
        while ( $records[] = $record = mssql_fetch_array($tr_type)) {
                print_r ($record);
        }
}

if ( count($records) ) {
        echo '<table>';

        foreach ( $records AS $id => $row ) {

echo <<<ROW
        <tr>
<td width='89' height='13' align='center' class='tblcell'><a href='javascript:editRecord({$row['card_id']})'>{$row['card_id']}</a></td> <td width='172' height='13' align='center' class='tblcell'>{$row['first_name']} {$row['last_name']}</td>
        </tr>
ROW;

        }
        echo '</table>';
}

?>   

Obviously, this is completely untested.  You should be able to run it.

I took out the table cells that had to do with the date/time and the total,

Not sure where you were getting that information from.

But this should give you a little better idea on how to do it.

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

--- End Message ---
--- Begin Message ---
Just noticed on that last one I forgot to change one variable name.

the line that was this
$tr_type = mssql_query($get_tr) or die(mssql_get_last_message());

change it to this
$tr_type = mssql_query($SQL) or die(mssql_get_last_message());


--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

--- End Message ---
--- Begin Message ---
You could install the system I wrote called "Roach". 
You can see an older version on my site (and I can post up or email you a
newer .tgz file):

http://daevid.com

I actively develop it for my company. We've used it for 6 years now. I *try*
to make my fixes generic, and I repost them periodically to my site in a tgz
file.

I actually like it a lot. We started with Mantis (again, years ago) and it
sucked ass, so we rolled our own (in typical startup/FOSS fashion).

There's a sourceforge project that I don't update (I use svn and not cvs and
don't care to set that up anymore). 
http://sourceforge.net/projects/roachphp/

D.Vin 

> -----Original Message-----
> From: Richard Heyes [mailto:[EMAIL PROTECTED] 
> Sent: Friday, November 16, 2007 2:32 AM
> To: Randy Patterson
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Open Source BTS??
> 
> > I am needing to install a bug tracking system on a web 
> server and looking for 
> > a good PHP open source solution. Looking for a pretty 
> mature system that 
> > still has active development. Thanks for any suggestions.
> 
> The only one I have had experience of is Mantis:
> 
> http://www.mantisbt.org/
> 
> No complaints here.
> 
> -- 
> Richard Heyes
> +44 (0)800 0213 172
> http://www.websupportsolutions.co.uk
> 
> Knowledge Base and HelpDesk software
> that can cut the cost of online support
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
We use Mantis and love it!  Works very well, but to each his own.

Also, SourceForge uses svn now.  Has for awhile.

On Nov 16, 2007 5:23 PM, Daevid Vincent <[EMAIL PROTECTED]> wrote:
> You could install the system I wrote called "Roach".
> You can see an older version on my site (and I can post up or email you a
> newer .tgz file):
>
> http://daevid.com
>
> I actively develop it for my company. We've used it for 6 years now. I *try*
> to make my fixes generic, and I repost them periodically to my site in a tgz
> file.
>
> I actually like it a lot. We started with Mantis (again, years ago) and it
> sucked ass, so we rolled our own (in typical startup/FOSS fashion).
>
> There's a sourceforge project that I don't update (I use svn and not cvs and
> don't care to set that up anymore).
> http://sourceforge.net/projects/roachphp/
>
> D.Vin
>
> > -----Original Message-----
> > From: Richard Heyes [mailto:[EMAIL PROTECTED]
> > Sent: Friday, November 16, 2007 2:32 AM
> > To: Randy Patterson
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [PHP] Open Source BTS??
> >
> > > I am needing to install a bug tracking system on a web
> > server and looking for
> > > a good PHP open source solution. Looking for a pretty
> > mature system that
> > > still has active development. Thanks for any suggestions.
> >
> > The only one I have had experience of is Mantis:
> >
> > http://www.mantisbt.org/
> >
> > No complaints here.
> >
> > --
> > Richard Heyes
> > +44 (0)800 0213 172
> > http://www.websupportsolutions.co.uk
> >
> > Knowledge Base and HelpDesk software
> > that can cut the cost of online support
> >
> > --
> > 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
>
>

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: M. Sokolewicz [mailto:[EMAIL PROTECTED] 
> Sent: Friday, November 16, 2007 3:45 AM
> To: [EMAIL PROTECTED]
> Cc: Randy Patterson; [EMAIL PROTECTED]
> Subject: Re: [PHP] Open Source BTS??
> 
> Richard Heyes wrote:
> >> I am needing to install a bug tracking system on a web server and 
> >> looking for a good PHP open source solution. Looking for a pretty 
> >> mature system that still has active development. Thanks for any 
> >> suggestions.
> > 
> > The only one I have had experience of is Mantis:
> > 
> > http://www.mantisbt.org/
> > 
> > No complaints here.
> > 
> 
> I'm personally a big fan of both bugzilla (www.bugzilla.org) and Trac 
> (trac.edgewall.org), both not php (perl, and python I 
> believe), but they 
> are both really really good imo.
> 
> - Tul

I user Trac for my Wiki my personal SVN repos. 
Here's an email I posted this list a couple weeks ago about the topic:

-----Original Message-----
From: Daevid Vincent [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 08, 2007 6:57 PM
To: [EMAIL PROTECTED]
Cc: 'TG'; 'Skip Evans'
Subject: RE: [PHP] Recommend a wiki?

I have had 'Trac' thrust upon me by an employee/coworker and while it is not
"perfect" (or even close to it), it does what it does, and it does it pretty
well.

http://trac.edgewall.org/ 

Some of my favorite things about it are:

        Wiki is pretty common tags 
          (http://trac.edgewall.org/wiki/WikiFormatting)
        Subversion integration with diff, view source, and
        svn commit hooks ("fixes, references, etc")
        You can integrate SQL 'reports' and the Wiki together. This rocks!
        Ticket tracking
        Roadmap graphs
        Plugins
        Can have different 'Tracs' setups on same server (I run two - biz
and personal)

On the negative side:

        It is a little tricky to install IMHO.
        It uses SQLlite (this is a pro and a con at the same time)
        doesn't seem to be updated with any frequency or regularity
        it's not even a 1.0 -- but that's all the rage with the kids it
seems
        v0.11 is due "any day now"
        all written in python (yuk)
        Tickets are sort of cumbersome 
          and they store the TEXTUAL names rather than relations. *sigh*
          (for example, if you change an employee, 
           you have to search and replace the NAME, 
         not just a 'user' relational link) .WTF.

--- End Message ---
--- Begin Message ---
I haven't used PhpED, but I use Zend Studio Pro at work.  It is hands-down the 
best PHP IDE I've used.  (As I said, I cannot compare it to PhpED 
specifically.)  Little things like project management and code completion and 
such "just work" better than any other tool I've found, and it's debugger and 
profiler are also first-rate.  Performance is good, too.

At home, I've been avoiding buying it because it's $300 flipping dollars, and 
I'm wary of their time-based licensing.  It's also, of course, very non-Free, 
and I try to stick to open source programs at home (and at work when I can).  
I've bounced around between a lot of different PHP editing tools.  At the 
moment I'm using Eclipse-PDT, which is finally not so slow as to be unsable 
as previous versions of Eclipse were.  It's nowhere near as nice as Zend 
Studio, but at least it's [F|f]ree and once you figure out the weirdness that 
is Eclipse it gets the job done.  Still need to get it talking to XDebug, 
though.

On Friday 16 November 2007, William Betts wrote:
> Have you ever used Zend Studio? If so how does it compare to PhpED?
>
> On Nov 16, 2007 5:37 AM, Arno Kuhl <[EMAIL PROTECTED]> wrote:
> > -----Original Message-----
> > From: David Giragosian [mailto:[EMAIL PROTECTED]
> > Sent: 16 November 2007 05:21
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP] IDE
> >
> > On 11/15/07, Jammer <[EMAIL PROTECTED]> wrote:
> > > Børge Holen wrote:
> > > > On Thursday 15 November 2007 21:35:04 Jammer wrote:
> > > >> Hi All,
> > > >>
> > > >> This is my first post here ... I'm very much a newbie to php but
> > > >> work during the day using SQL Server, VS2005 and Foxpro.  Looking
> > > >> to gen up on my PHP.
> > > >>
> > > >> Are there any IDE's for PHP worth checking out.  Particularly free
> > >
> > > ones!
> > >
> > > >> TIA,
> > > >>
> > > >> --
> > > >> jammer
> > > >> www.jammer.biz
> > > >
> > > > I LOVE this IDE quiz'
> > > > the same answers everytime.
> > >
> > > duh!
> > >
> > > look, i'm really sorry everyone ... we all make mistakes!
> > >
> > > if this is a question that comes up as often as it appears from the
> > > responses this thread has generated maybe the FAQ needs to *really*
> > > address that?
> > >
> > > http://uk3.php.net/FAQ.php
> > >
> > > --
> > > jammer
> >
> > It's OK. I think there's been a long thread on the subject each of the
> > last two weeks. The folks who are really passionate about their IDE's
> > jump in first, then those less motivated or less interested add theirs,
> > then it seems to die for a day or so before it rises from the ashes to
> > sputter and hiccup a time or two. And then it starts all over, again.
> >
> > If you stick around long enough on this list, you'll be fussin' at the
> > question, too.
> >
> > David
> > --------------------------
> >
> > I think jammer's idea is a good one. I've been lurking on this list for
> > years and seen many resurrections of the IDE thread. It's an important
> > thread, and the PHP IDE world is ever changing and new products come onto
> > the scene every now and then. I use my favourite commercial IDE but quite
> > frequently check out the other IDE's mentioned in those threads, mostly
> > to confirm the choice I made 4 years ago is still the right one. A
> > well-maintained list of free and commercial PHP IDE's on the php.net site
> > would be a great idea, especially if it also had links to reviews, and
> > also included the mix-n-match IDE's I see some people on the list use.
> > And/or maybe a forum on php.net dedicated to PHP IDE's, with user polls.
> > Then whenever the IDE thread pops up the response would be to look at the
> > web site (RTFWS). The only downside might be the resources to run it.
> >
> > BTW jammer, if you start using php for big projects I'd recommend
> > NuSphere PhpED, but it's overkill if you just want to dabble. There's a
> > trial version if you want to check it out, and a good tip is they drop
> > the price every now and then for promotions (wish I knew that 4 years
> > ago).
> >
> > Arno
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php


-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

--- End Message ---
--- Begin Message ---


You should give a chance to Quanta Plus.

Regards



Frank Lopes wrote:
> 
> Being very new to PHP (empahsis on VERY...), I wonder what most of you use 
> to develop in PHP?
> 
> I have experimented with DreamWeaver, UltraEdit, phoDesigner, Eclipse etc.
> 
> What would you recommend that I use?
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 


-----
  
  
  
----------------

Cem Kayalı

-- 
View this message in context: 
http://www.nabble.com/PHP-editor-tf4786258.html#a13805151
Sent from the PHP - General mailing list archive at Nabble.com.

--- End Message ---
--- Begin Message ---

You should give a chance to Quanta Plus on Linux/BSd and Mr. Soysal's free
edition of PhpEd, if you can find it.

Regards



Frank Lopes wrote:
> 
> Being very new to PHP (empahsis on VERY...), I wonder what most of you use 
> to develop in PHP?
> 
> I have experimented with DreamWeaver, UltraEdit, phoDesigner, Eclipse etc.
> 
> What would you recommend that I use?
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 


-----
  
  
  
----------------

Cem Kayalı

-- 
View this message in context: 
http://www.nabble.com/PHP-editor-tf4786258.html#a13805151
Sent from the PHP - General mailing list archive at Nabble.com.

--- End Message ---
--- Begin Message ---
You should give a chance to Quanta Plus on Linux/BSd and Mr. Soysal's free
edition of PhpEd On Windows, if you can find it.

Regards



Frank Lopes wrote:
> 
> Being very new to PHP (empahsis on VERY...), I wonder what most of you use 
> to develop in PHP?
> 
> I have experimented with DreamWeaver, UltraEdit, phoDesigner, Eclipse etc.
> 
> What would you recommend that I use?
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 


-----
  
  
  
----------------

Cem Kayalı

-- 
View this message in context: 
http://www.nabble.com/PHP-editor-tf4786258.html#a13805151
Sent from the PHP - General mailing list archive at Nabble.com.

--- End Message ---
--- Begin Message ---
On Nov 16, 2007 10:30 AM, Peter Ford <[EMAIL PROTECTED]> wrote:
>
> >
> >     I was all ready to jump on Point #6 to disagree until I read the
> > next paragraph, updating that with the correct information.  PHP can
> > find out the OS of the system on which the browser is running.
> >
>
> Strictly speaking, PHP can only find out what the browser tells it - that
> includes the OS. I could quite easily hack the browser info string sent by (at
> least one of) my browsers to pretend I was using some horrible Windows 
> rubbish...
>
>

I use the User-Agent Switcher add-on for Firefox for this. It's so
easy I don't even really consider it a "hack" -- it's a "feature". :-)
With it, I can not only change the UserAgent string sent in web page
requests, but I can also change the values of the userAgent, appName,
appVersion, platform, vendor and vendorSub properties of the built-in
navigator object in JavaScript.

Andrew

--- End Message ---
--- Begin Message ---



Peter Ford-4 wrote:
> 
>> 
>>     I was all ready to jump on Point #6 to disagree until I read the
>> next paragraph, updating that with the correct information.  PHP can
>> find out the OS of the system on which the browser is running.
>> 
> 
> Strictly speaking, PHP can only find out what the browser tells it - that
> includes the OS. I could quite easily hack the browser info string sent by
> (at
> least one of) my browsers to pretend I was using some horrible Windows
> rubbish...
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


That's true... if you use ie; konquerer, and adjust settings as "send no
identification", then php script has nothing to determine browser type, OS
etc. etc. The other way to hide identification + ip address is to use proxy
servers, which is very common nowadays.

Regards,






-----
  
  
  
----------------

Cem Kayalı

-- 
View this message in context: 
http://www.nabble.com/-NEWBIE-GUIDE--For-the-benefit-of-new-members-tf4817245.html#a13807542
Sent from the PHP - General mailing list archive at Nabble.com.


--- End Message ---
--- Begin Message ---
I have a bank account and would like to query the last transactions.

I can do that now via web and think that I can convert this procedure to
a list of curl requests and finally put the result into a database on my
server.
Fortunately this bank account does not allow transactions, just viewing
the account.

Is there a guide available how to start this project?

bye

Ronald

--- End Message ---

Reply via email to