Re: [PHP] PHP & Emacs

2012-05-04 Thread Gerardo Benitez
Hi Mihamina,

I think that a few number of people use Emacs to write Php, in fact for
proffesionals porpuse the people use a IDE for Php, like Netbeams, Eclipse
PDT or Zend Studio.

Regards,
Gerardo

On Wed, May 2, 2012 at 8:21 AM, Mihamina Rakotomandimby
wrote:

> Hi all,
>
> For curiosity, are there people here using Emacs to code in PHP?
> What modes do you add? cedet, ecb,...
>
> I see (just for the example) that Drupal has a short documentation page
> for Emacs http://drupal.org/node/59868
>
> Have you got some in your bookmarks for general PHP coding?
>
> --
> RMA.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Gerardo Benitez
-
Programador Web Freelance


Re: [PHP] Best PHP Template System

2012-05-04 Thread Gerardo Benitez
I have used smarty in project with pure php and the template system of Zend
Framework in proyects done in Zend Framework, both are fine for me.


Gerardo.


On Thu, Apr 26, 2012 at 5:48 AM, Simon Schick
wrote:

> On Thu, Apr 26, 2012 at 12:07 AM, Yared Hufkens  wrote:
> >
> > Why use an external engine which slows your scripts down to do something
> > which can easily be done by PHP itself? PHP is imho the best template
> engine
> > for PHP.
> > With PHP 5.4, it became even easier because somestuff()?> can be
> > used without short_open_tag enabled.
> > However, you always schould divide UI and backend.
> >
>
> Hi,
>
> If you like to write an xml-template by having purely xml, you could
> also use OPT (Open Power Template).
>
> You can f.e. add a attribute to a tag by decision by writing this code:
>
> 
>
>Content
> 
>
> Feels a bit cleaner to me than writing
>
> class="highlight">
>Content
> 
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Gerardo Benitez
-
Programador Web Freelance


[PHP] Re: function

2012-05-04 Thread Jim Giner
""Ron Piggott""  wrote in message 
news:499A66F0FB394E1DB44F7E0C011CF11C@RonPiggottPC...
I need to access a FUNCTION I programmed within a different FUNCTION.  Are 
these able to be passed like a variable?  Or are they able to become like a 
$_SESSION variable in nature?  How am I able to do this?

Why not just separate the functions?  Then you won't have any problem like 
that.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calculating driving distance between UK postcodes

2012-05-04 Thread David OBrien
Google is still your friend

On Fri, May 4, 2012 at 9:36 AM, Terry Ally (Gmail) wrote:

> Does anyone have a working/example PHP script that calculates driving
> distances between UK postcodes that they can share?
>
> Thanks
>
> --
> *Terry Ally*
> Twitter.com/terryally
> Facebook.com/terryally
> ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
> To print or not to print this email is the environmentally-searching
> question!
> Which has the highest ecological cost? A sheet of paper or constantly
> switching on your computer and connecting to the Internet to read your
> email?
>

http://stackoverflow.com/questions/2296087/using-php-and-google-maps-api-to-work-out-distance-between-2-post-codes-uk


[PHP] PHP & Database Problems -- Code Snippets - Any more Ideas?

2012-05-04 Thread Ethan Rosenberg
I am sending this again to see if more ideas for solution of this 
problem are available.


Ethan
===
Dear list -

Sorry for the attachment.  Here are code snippets ---

GET THE DATA FROM INTAKE3:

function handle_data()
{
   global $cxn;
   $query = "select * from Intake3 where  1";



   if(isset($_Request['Sex'])&& trim($_POST['Sex']) != '' )
   {
if ($_REQUEST['Sex'] === "0")
{
   $sex = 'Male';
}
else
{
   $sex = 'Female';
}
   }

}

$allowed_fields = array
   (  'Site' =>$_POST['Site'], 'MedRec' => $_POST['MedRec'], 
'Fname' => $_POST['Fname'], 'Lname' => $_POST['Lname'] ,
 'Phone' => $_POST['Phone'] , 'Sex' => $_POST['Sex']  , 
'Height' => $_POST['Height']  );


if(empty($allowed_fields))
{
  echo "ouch";
}

$query = "select * from Intake3  where  1 ";

foreach ( $allowed_fields as $key => $val )
{
   if ( (($val != '')) )

{
   $query .= " AND ($key  = '$val') ";
}
   $result1 = mysqli_query($cxn, $query);
}

$num = mysqli_num_rows($result1);
if(($num = mysqli_num_rows($result1)) == 0)
{
?>
No Records Retrieved #1

>> THIS SEEMS TO BE THE ROUTINE THAT IS FAILING <<<

Search Results

cellspacing="55"  rules="all"  frame="box">


Site
Medical Record
First Name
Last Name
Phone
Height
Sex
History


n1 ";echo $n1;
{
   if (($n1 > 2) && ($MDRcheck == $row1[1]))
   {
echo ">2==  ";
echo $MDRcheck;
echo " $row1[0] \n";
echo " $row1[1] \n";
echo " $row1[2] \n";
echo " $row1[3] \n";
echo " $row1[4] \n";
echo " $row1[5] \n";
echo " $row1[6] \n";
echo " $row1[7] \n";
echo "\n";
   }
   elseif (($n1 > 2) && ($MDRcheck != $row1[1]))
   {
echo ">2!=  ";

echo $MDRcheck;


continue;
   }
   elseif ($n1 == 2)
   {

define( "MDR" ,  $row1[1]);
echo "row1 ";echo $row1[1];
echo "\n";

$_GLOBALS['mdr']= $row1[1];
$_POST['MedRec'] = $row1[1];
$MDRold = $_GLOBALS['mdr'];
echo " $row1[0] \n";
echo " $row1[1] \n";
echo " $row1[2] \n";
echo " $row1[3] \n";
echo " $row1[4] \n";
echo " $row1[5] \n";
echo " $row1[6] \n";
echo " $row1[7] \n";
echo "\n";
   }

}
   }

?>

SELECT AND DISPLAY DATA FROM VISIT3 DATABASE

$query2 = "select * from Visit3 where  1 AND (Site = 'AA')  AND 
(MedRec = $_GLOBALS[mdr])";

$result2 = mysqli_query($cxn, $query2);
$num = mysqli_num_rows($result2);


global $finished;
$finished = 0;


while($row2 = mysqli_fetch_array($result2, MYSQLI_BOTH))
{
   global $finished;
   echo "\n";
   echo " $row2[0] \n";
   echo " $row2[1] \n";
   echo " $row2[2] \n";
   echo " $row2[3] \n";
   echo " $row2[4] \n";
   echo " $row2[5] \n";
   echo " $row2[6] \n";
   echo "\n";

}

echo "";

ENTER MORE DATA:

function More_Data()
{
   $decision = 5;
?>

Do you Wish to Enter More Data?

Yes 
No



 

end function More_Data



switch ( @$_POST[next_step] )
{

   case "step10":
   {
if (!isset($_POST['decision']))
{
   $_POST['decision'] = 5;
}

if ($_POST['decision'] == 0)
{
   exit();
}
if ($_POST['decision'] == 1)
{
 ;
   echo "";
echo "value=\"step4\" />";

echo "";
echo "Medical Record:  name=\"MedRec\" value=\" $_GLOBALS[mdr]\" />";
echo "   Weight: name=\"Weight\" />  ";

echo "Notes:  ";
echo "rows=\"10\" wrap=\"hard\" name=\"Notes\" > ";

echo "";
echo " ";

echo "";
   echo "";


   }

} /*  End Step10 */


case "step4":
{
   if (!isset($_POST['datain']))
   {
$_POST['datain'] = 5;
   }



   if( $_POST['datain'] == "already")
   {

date_default_timezone_set('America/New_York');


$Date  = date('Ymd');
$Date2 = date('d M Y');
$sql1 = "select MedRec, Height from Intake3 where 
(MedRec = $MDRold)";

$result4 = mysqli_query($cxn, $sql1);
$row4 = m

Re: [PHP] Calculating driving distance between UK postcodes

2012-05-04 Thread Terry Ally (Gmail)
Google works in Javascript extensively - not a language with which I
have in-depth experience hence my reason for asking for PHP solution.

For example the following will get me a JSON output with the distance in
Kms and time. I don't know how to get PHP to read this information and
extract just the distance. I need the distance so that I can calculate cost
of a trip.

http://maps.googleapis.com/maps/api/distancematrix/json"; method="get">




Get
Distance






On 4 May 2012 15:08, David OBrien  wrote:

> Google is still your friend
>
> On Fri, May 4, 2012 at 9:36 AM, Terry Ally (Gmail) wrote:
>
>> Does anyone have a working/example PHP script that calculates driving
>> distances between UK postcodes that they can share?
>>
>> Thanks
>>
>> --
>> *Terry Ally*
>>
>> Twitter.com/terryally
>> Facebook.com/terryally
>> ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
>> To print or not to print this email is the environmentally-searching
>> question!
>> Which has the highest ecological cost? A sheet of paper or constantly
>> switching on your computer and connecting to the Internet to read your
>> email?
>>
>
>
> http://stackoverflow.com/questions/2296087/using-php-and-google-maps-api-to-work-out-distance-between-2-post-codes-uk




-- 
*Terry Ally*
Twitter.com/terryally
Facebook.com/terryally
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
To print or not to print this email is the environmentally-searching
question!
Which has the highest ecological cost? A sheet of paper or constantly
switching on your computer and connecting to the Internet to read your
email?


Re: [PHP] PHP & Database Problems -- Code Snippets - Any more Ideas?

2012-05-04 Thread Jim Giner
I don't think posting the same voluminous code is going to generate any 
better responses.

The suggestion to start over and make your insert/retrieve queries fool 
proof before starting to write some logic into your code was a very good 
one.  Why don't you work on that so that any requests for help can focus on 
just that instead of the 100+ lines of code you are posting?  Reading some 
documentation on sql and some html/php relationships would be VERY 
beneficial to your long-term success as a programmer as well. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP & Database Problems -- Code Snippets - Any more Ideas?

2012-05-04 Thread Jim Giner
Nor will posting to multiple lists.(Sorry to the rest of you - didn't 
realize it until now.)

""Jim Giner""  wrote in message 
news:c6.f8.38082.efae3...@pb1.pair.com...
>I don't think posting the same voluminous code is going to generate any 
>better responses.
>
> The suggestion to start over and make your insert/retrieve queries fool 
> proof before starting to write some logic into your code was a very good 
> one.  Why don't you work on that so that any requests for help can focus 
> on just that instead of the 100+ lines of code you are posting?  Reading 
> some documentation on sql and some html/php relationships would be VERY 
> beneficial to your long-term success as a programmer as well.
> 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] howto get pgUp, pgDn, delete, home and end keycodes in CLI PHP script

2012-05-04 Thread Andres Gonzalez
I am trying to code a CLI PHP script that will give me the keycodes for 
these (and other) keyboard keys. I want to basically block until the 
user presses a single key, then I want to process that event without the 
user having to press the Enter key after pressing a single key.


I have tried several approaches but with no success.  Using fopen() to 
open stdin, and fgetc() will give me the regular keys but requires the 
user to press the Enter key after the initial key is pressed. When I 
press the the PgDw key for example, those routines return a single 
character string even though the stty echos a 5 character string (using 
PgDw echos "^[[6~")


I have tried other approaches using bash read commands to get a single 
character but will little success also.


Anybody here know how to do this?

Thanks,

-Andres

|
|

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] howto get pgUp, pgDn, delete, home and end keycodes in CLI PHP script

2012-05-04 Thread David OBrien


On Fri, May 4, 2012 at 10:48 AM, Andres Gonzalez wrote:

> I am trying to code a CLI PHP script that will give me the keycodes for
> these (and other) keyboard keys. I want to basically block until the user
> presses a single key, then I want to process that event without the user
> having to press the Enter key after pressing a single key.
>
> I have tried several approaches but with no success.  Using fopen() to
> open stdin, and fgetc() will give me the regular keys but requires the user
> to press the Enter key after the initial key is pressed. When I press the
> the PgDw key for example, those routines return a single character string
> even though the stty echos a 5 character string (using PgDw echos "^[[6~")
>
> I have tried other approaches using bash read commands to get a single
> character but will little success also.
>
> Anybody here know how to do this?
>
> Thanks,
>
> -Andres
>
> |
> |
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
I think something like this would work

$running = true;
$fp = fopen("php://stdin","r");//open direct input stream for reading
stream_set_blocking($fp,0);//set non-blocking mode

while ($running) {
  while (($buf = fgets($fp, 4096)) != false) {
 $buffer .= $buf;
  }
  if ($buffer != "") {
 switch ($buffer) {
   case " ": {//exit on space key
exit;
   }
   default: {
 //space not pressed
   }
 }
$buffer = ""; //empty buffer
   }


Re: [PHP] howto get pgUp, pgDn, delete, home and end keycodes in CLI PHP script

2012-05-04 Thread Andres Gonzalez

David,

Thank you for your response.

The code does not run on my box. I get an undefined variable error on the:
if ($buffer != "") {
line.

Also, I need the code to block until the user presses a single key. 
Plus, the fgets() routine does not return extended codes for pgUp, pgDn, 
etc, only codes for regular keys.


-Andres




David OBrien wrote:

?

On Fri, May 4, 2012 at 10:48 AM, Andres Gonzalez 
mailto:and...@packetstorm.com>> wrote:


I am trying to code a CLI PHP script that will give me the
keycodes for these (and other) keyboard keys. I want to basically
block until the user presses a single key, then I want to process
that event without the user having to press the Enter key after
pressing a single key.

I have tried several approaches but with no success. Using fopen()
to open stdin, and fgetc() will give me the regular keys but
requires the user to press the Enter key after the initial key is
pressed. When I press the the PgDw key for example, those routines
return a single character string even though the stty echos a 5
character string (using PgDw echos "^[[6~")

I have tried other approaches using bash read commands to get a
single character but will little success also.

Anybody here know how to do this?

Thanks,

-Andres

|
|

-- 
PHP General Mailing List (http://www.php.net/)

To unsubscribe, visit: http://www.php.net/unsub.php


I think something like this would work

$running = true;
$fp = fopen("php://stdin","r"); //open direct input stream for reading
stream_set_blocking($fp,0); //set non-blocking mode

while ($running) {
while (($buf = fgets($fp, 4096)) != false) {
$buffer .= $buf;
}
if ($buffer != "") {
switch ($buffer) {
case " ": { //exit on space key
exit;
}
default: {
//space not pressed
}
}
$buffer = ""; //empty buffer
}




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP & Database Problems -- Code Snippets - Any more Ideas?

2012-05-04 Thread Govinda
Ethan, 

before you get   frustrated or feel abandoned, let me *sincerely* try to help:

Here is honestly what I am utterly convinced you need to do to get any where in 
the medium/long run:

Break everything down into very small steps.  Making web apps is just building 
a whole lot of layers/collections of very small simple things.  Nothing is out 
of your grasp.. it only appears mysterious or complicated because you are not 
familiar with the terms/code structures and have not spent enough time with the 
little things to recognize them like english speakers do when reading written 
english.  So what you do to get out of the woods (and it works every time), 
regardless of the problem, is just focus on one small thing at a time.  

START OVER.  

Throw out all the code, especially everything you borrowed from other sources.  
Write everything yourself, from scratch.  Just print "hello" to a web page.  
Then add in the ability to do ONE more thing that you need... like reading from 
a db, or writing to a db...  and then processing/manipulating things, as you 
need.  Test everything every time you add even ONE little feature.  Then as 
soon as something breaks, you know instantly where the issue lays.. and focus 
on solving why that one little thing is broken.  If re-reading the docs about 
whatever code structures you used at that point (of your newly-added broken 
feature) does not clear it up for you, then post just that ONE little issue to 
this list.. asking why that one thing is behaving that way.  Like this (using 
this tedious but effective method) , you will get your code into shape so it 
works, you will not alienate yourself from the help you need (by posting 
volumes of broken code with no evidence that you are actually trying to learn), 
and best of all - you will, step by step, come to master all this stuff!

Everyone loves to help answer/clear up one little thing, but no one has time to 
digest a whole broken page/app and tell you where all the issues are.  Even if 
they did have the time and inclination, they would lose it after the very first 
time they saw you take what they gave you and come back 3 weeks later with 
evidence that you never learned anything from the last episode.  Believe me you 
will always have people climbing over each other to help you, if you can just 
break down your problems into such small portions that you will be able to 
realize you have the smarts to answer them yourself.  ;-)   

There is a very lively, effective and popular coders community (and Q/A tool 
set) here:
http://stackoverflow.com/

..where you get almost instant help to any coding question.. because there are 
so many people who really care to give quality help, because they get 
recognized for their contributions.  But  if you try to use the tools at 
stackoverflow.com then you will find there, in that very professional 
atmosphere, that (to get anywhere) you HAVE to ask questions that are distilled 
down to something very specific and answerable in a specific/factual kind of 
way, as opposed to question that bring up more fuzzy-boundaried topics, like 
questions of preference or style, or questions that show an utter lack of 
homework/effort on the part of the asker which require more than a couple 
specific facts to answer.

You can train here or on stackoverflow.com, but anywhere you go, you will find 
the same situation, that you have to use baby steps (as necessary) - for your 
own learning, and to get any decent help.

-Govinda
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] RE: [PHP-DB] [PHP] PHP & Database Problems -- Code Snippets - Any more Ideas?

2012-05-04 Thread Gavin Chalkley
Ethan,

You have been given advise and break down on your code.

Have you taken the advise given?

Which part of the code isn't working? Not which chunk, but break it down and
show which part

BR,

Gav

-Original Message-
From: Ethan Rosenberg [mailto:eth...@earthlink.net] 
Sent: 04 May 2012 15:10
To: php-db-lists.php.net; php-general@lists.php.net
Subject: [PHP-DB] [PHP] PHP & Database Problems -- Code Snippets - Any more
Ideas?

I am sending this again to see if more ideas for solution of this problem
are available.

Ethan
===
Dear list -

Sorry for the attachment.  Here are code snippets ---

GET THE DATA FROM INTAKE3:

 function handle_data()
 {
global $cxn;
$query = "select * from Intake3 where  1";



if(isset($_Request['Sex'])&& trim($_POST['Sex']) != '' )
{
 if ($_REQUEST['Sex'] === "0")
 {
$sex = 'Male';
 }
 else
 {
$sex = 'Female';
 }
}

 }

 $allowed_fields = array
(  'Site' =>$_POST['Site'], 'MedRec' => $_POST['MedRec'], 'Fname' =>
$_POST['Fname'], 'Lname' => $_POST['Lname'] ,
  'Phone' => $_POST['Phone'] , 'Sex' => $_POST['Sex']  ,
'Height' => $_POST['Height']  );

 if(empty($allowed_fields))
 {
   echo "ouch";
 }

 $query = "select * from Intake3  where  1 ";

 foreach ( $allowed_fields as $key => $val )
 {
if ( (($val != '')) )

 {
$query .= " AND ($key  = '$val') ";
 }
$result1 = mysqli_query($cxn, $query);
 }

 $num = mysqli_num_rows($result1);
 if(($num = mysqli_num_rows($result1)) == 0)
 {
?>
 No
Records Retrieved #1 >> THIS SEEMS TO BE THE ROUTINE THAT IS FAILING <<<

 Search Results

 
 
 Site
 Medical Record
 First Name
 Last Name
 Phone
 Height
 Sex
 History
 

n1 ";echo $n1;
 {
if (($n1 > 2) && ($MDRcheck == $row1[1]))
{
 echo ">2==  ";
 echo $MDRcheck;
 echo " $row1[0] \n";
 echo " $row1[1] \n";
 echo " $row1[2] \n";
 echo " $row1[3] \n";
 echo " $row1[4] \n";
 echo " $row1[5] \n";
 echo " $row1[6] \n";
 echo " $row1[7] \n";
 echo "\n";
}
elseif (($n1 > 2) && ($MDRcheck != $row1[1]))
{
 echo ">2!=  ";

 echo $MDRcheck;


 continue;
}
elseif ($n1 == 2)
{

 define( "MDR" ,  $row1[1]);
 echo "row1 ";echo $row1[1];
 echo "\n";

 $_GLOBALS['mdr']= $row1[1];
 $_POST['MedRec'] = $row1[1];
 $MDRold = $_GLOBALS['mdr'];
 echo " $row1[0] \n";
 echo " $row1[1] \n";
 echo " $row1[2] \n";
 echo " $row1[3] \n";
 echo " $row1[4] \n";
 echo " $row1[5] \n";
 echo " $row1[6] \n";
 echo " $row1[7] \n";
 echo "\n";
}

 }
}

?>

SELECT AND DISPLAY DATA FROM VISIT3 DATABASE

\n";
echo " $row2[0] \n";
echo " $row2[1] \n";
echo " $row2[2] \n";
echo " $row2[3] \n";
echo " $row2[4] \n";
echo " $row2[5] \n";
echo " $row2[6] \n";
echo "\n";

 }

echo "";

ENTER MORE DATA:

 function More_Data()
 {
$decision = 5;
?>

 Do you Wish to Enter More Data?
 
 Yes 
No
 
 
  

end function More_Data



 switch ( @$_POST[next_step] )
 {

case "step10":
{
 if (!isset($_POST['decision']))
 {
$_POST['decision'] = 5;
 }

 if ($_POST['decision'] == 0)
 {
exit();
 }
 if ($_POST['decision'] == 1)
 {
  ;
echo "";
 echo "";
 echo "";
 echo "Medical Record:  ";
 echo "   Weight:   ";
 echo "Notes:  ";
 echo " ";
 echo "";
 echo " ";

 echo "";
echo "";


}

 } /*  End Step10 */


 case "step4":
 {
if (!isset($_POST['datain']))
{
 $_POST['datain'] = 5;
}



if( $_POST['datain'] == "already")
{

 date_default_timezone_set('America/New_York');


 $Date  = date('Ymd');
 $Date2 = date('d M Y');
 $sql1 = "select MedRec, Height from Intake3 where 
(MedRec =

Re: [PHP] howto get pgUp, pgDn, delete, home and end keycodes in CLI PHP script

2012-05-04 Thread Stuart Dallas
On 4 May 2012, at 15:48, Andres Gonzalez wrote:

> I am trying to code a CLI PHP script that will give me the keycodes for these 
> (and other) keyboard keys. I want to basically block until the user presses a 
> single key, then I want to process that event without the user having to 
> press the Enter key after pressing a single key.
> 
> I have tried several approaches but with no success.  Using fopen() to open 
> stdin, and fgetc() will give me the regular keys but requires the user to 
> press the Enter key after the initial key is pressed. When I press the the 
> PgDw key for example, those routines return a single character string even 
> though the stty echos a 5 character string (using PgDw echos "^[[6~")
> 
> I have tried other approaches using bash read commands to get a single 
> character but will little success also.
> 
> Anybody here know how to do this?

As far as I know you can't do this through any of the built-in functions. 
However, the ncurses extension may give you what you need: 
http://php.net/ncurses

-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] howto get pgUp, pgDn, delete, home and end keycodes in CLI PHP script

2012-05-04 Thread Andres Gonzalez

Thank you for your reply Stuart, I will look at ncurses extensions.

-Andres


Stuart Dallas wrote:

On 4 May 2012, at 15:48, Andres Gonzalez wrote:

  

I am trying to code a CLI PHP script that will give me the keycodes for these 
(and other) keyboard keys. I want to basically block until the user presses a 
single key, then I want to process that event without the user having to press 
the Enter key after pressing a single key.

I have tried several approaches but with no success.  Using fopen() to open stdin, and 
fgetc() will give me the regular keys but requires the user to press the Enter key after 
the initial key is pressed. When I press the the PgDw key for example, those routines 
return a single character string even though the stty echos a 5 character string (using 
PgDw echos "^[[6~")

I have tried other approaches using bash read commands to get a single 
character but will little success also.

Anybody here know how to do this?



As far as I know you can't do this through any of the built-in functions. 
However, the ncurses extension may give you what you need: 
http://php.net/ncurses

-Stuart

  


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calculating driving distance between UK postcodes

2012-05-04 Thread Mike Mackintosh
On Friday, May 4, 2012 at 10:18, Terry Ally (Gmail) wrote:
> Google works in Javascript extensively - not a language with which I
> have in-depth experience hence my reason for asking for PHP solution.
> 
> For example the following will get me a JSON output with the distance in
> Kms and time. I don't know how to get PHP to read this information and
> extract just the distance. I need the distance so that I can calculate cost
> of a trip.
> 
> http://maps.googleapis.com/maps/api/distancematrix/json"; method="get">
> 
> 
> 
> 
>  onClick="document.getElementById('google').submit()">Get
> Distance
> 
> 
> 
> 
> 
> 
> On 4 May 2012 15:08, David OBrien  wrote:
> 
> > Google is still your friend
> > 
> > On Fri, May 4, 2012 at 9:36 AM, Terry Ally (Gmail) 
> > wrote:
> > 
> > > Does anyone have a working/example PHP script that calculates driving
> > > distances between UK postcodes that they can share?
> > > 
> > > Thanks
> > > 
> > > --
> > > *Terry Ally*
> > > 
> > > Twitter.com/terryally
> > > Facebook.com/terryally
> > > ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
> > > To print or not to print this email is the environmentally-searching
> > > question!
> > > Which has the highest ecological cost? A sheet of paper or constantly
> > > switching on your computer and connecting to the Internet to read your
> > > email?
> > > 
> > 
> > 
> > 
> > http://stackoverflow.com/questions/2296087/using-php-and-google-maps-api-to-work-out-distance-between-2-post-codes-uk
> 
> 
> 
> 
> -- 
> *Terry Ally*
> Twitter.com/terryally
> Facebook.com/terryally
> ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
> To print or not to print this email is the environmentally-searching
> question!
> Which has the highest ecological cost? A sheet of paper or constantly
> switching on your computer and connecting to the Internet to read your
> email?
> 
> 

You should look into curl. Make a post request with the form data as post 
payload. 


-- 
Mike Mackintosh
www.HighOnPHP.com

Re: [PHP] PHP & Database Problems -- Code Snippets - Any more Ideas?

2012-05-04 Thread Marco Behnke



Am 04.05.2012 16:09, schrieb Ethan Rosenberg:

function handle_data()
{
global $cxn;


What does this function? It neither takes any parameters nor returns any 
value. And it does not write back anything to its global $cxn. So it is 
quite useless and can be deleted.



$query = "select * from Intake3 where 1";



if(isset($_Request['Sex'])&& trim($_POST['Sex']) != '' )


there is no variable $_Request, it is $_REQUEST.
Why do you test on $_REQUEST and compare it with trimmed $_POST?


{
if ($_REQUEST['Sex'] === "0")
{
$sex = 'Male';
}
else
{
$sex = 'Female';
}


Why do you set a variable that is never used?


$allowed_fields = array
( 'Site' =>$_POST['Site'], 'MedRec' => $_POST['MedRec'], 'Fname' =>
$_POST['Fname'], 'Lname' => $_POST['Lname'] ,
'Phone' => $_POST['Phone'] , 'Sex' => $_POST['Sex'] , 'Height' =>
$_POST['Height'] );
if(empty($allowed_fields))
{
echo "ouch";
}
$query = "select * from Intake3 where 1 ";
foreach ( $allowed_fields as $key => $val )
{
if ( (($val != '')) )
{
$query .= " AND ($key = '$val') ";


Why the hell do you put unverified data into an sql query?


DISPLAY THE INPUT3 DATA:

 >>> THIS SEEMS TO BE THE ROUTINE THAT IS FAILING <<<


What fails?
I do not have access to your database, so I can not run your code to see 
what fails.



n1 ";echo $n1;
{
if (($n1 > 2) && ($MDRcheck == $row1[1]))


What is $MDRcheck and what does this comparision mean?


SELECT AND DISPLAY DATA FROM VISIT3 DATABASE



Quotes around mdr missing


$result2 = mysqli_query($cxn, $query2);
$num = mysqli_num_rows($result2);


global $finished;
$finished = 0;


while($row2 = mysqli_fetch_array($result2, MYSQLI_BOTH))
{
global $finished;


No need to global that twice.
And why ndo you use global and $_GLOBALS? STick to one or better skip it 
anyways. Globals are not to be used!



switch ( @$_POST[next_step] )


Remove all @ from your code or you won't see any errors on this.
Do proper checking and do NOT suppress errors or warnings.


echo "";
echo "";
echo "";
echo "Medical Record:  ";


Quotes.


$Weight = $_POST['Weight'];
$Notes = $_POST['Notes'];
$sql2 = "INSERT INTO Visit3(Indx, Site, MedRec, Notes, Weight, BMI,
Date) VALUES(null, '$Site', '$MDRold', '$Notes',


Do NOT NEVER put data that is user input unchecked into a query.


?>

?>


Double closing tag?


echo " $_GLOBALS[mdr] \n";


Quotes.


$flag = 1;


What's this?

You really really should seperate your code from HTML.
Please truncate your apache and php error log.
Add

error_reporting(E_ALL);
ini_set('display_errors', 'On');

at the top of every php file right after Remove all @ from your lines and execute your script another time and 
see what errors are appear into your browser and your logfiles. Post 
them and the codelines for these errors on the list.


--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz



smime.p7s
Description: S/MIME Kryptografische Unterschrift


[PHP] Running through an enormous SQL file

2012-05-04 Thread Brian Dunning
I have a script that downloads a 267MB SQL file (it creates and loads a MySQL 
database). Any idea how to do this? Obviously I'm not going to get a file that 
size into memory to loop through.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Running through an enormous SQL file

2012-05-04 Thread Bastien


Bastien Koert

On 2012-05-04, at 7:36 PM, Brian Dunning  wrote:

> I have a script that downloads a 267MB SQL file (it creates and loads a MySQL 
> database). Any idea how to do this? Obviously I'm not going to get a file 
> that size into memory to loop through.
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

Break it into chunks
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Running through an enormous SQL file

2012-05-04 Thread tamouse mailing lists
On Fri, May 4, 2012 at 6:36 PM, Brian Dunning  wrote:
> I have a script that downloads a 267MB SQL file (it creates and loads a MySQL 
> database). Any idea how to do this? Obviously I'm not going to get a file 
> that size into memory to loop through.

Is there any need to use PHP with this at all? If it's already in SQL,
can't you just feed it to mysql?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Calculating driving distance between UK postcodes

2012-05-04 Thread tamouse mailing lists
On Fri, May 4, 2012 at 9:18 AM, Terry Ally (Gmail)  wrote:
> Google works in Javascript extensively - not a language with which I
> have in-depth experience hence my reason for asking for PHP solution.
>
> For example the following will get me a JSON output with the distance in
> Kms and time. I don't know how to get PHP to read this information and
> extract just the distance. I need the distance so that I can calculate cost
> of a trip.
>
> http://maps.googleapis.com/maps/api/distancematrix/json"; method="get">
> 
> 
> 
> 
>  onClick="document.getElementById('google').submit()">Get
> Distance
> 

Using Google Maps API is pretty straight-forward. You don't need to
set up a form or a use a POST to get the info. This page should
describes how to use a standard GET query to get the info you want:

< https://developers.google.com/maps/documentation/distancematrix/ >

Setting up the proper URL to call, you can activate it using
file_get_contents provided you have allow_url_fopen set to true in
php.ini. (Do make sure to check for possible errors returned.)

You can get the response back as either JSON or XML, both of which PHP
can parse into useful data structures:

< http://us.php.net/manual/en/function.json-decode.php >

< http://us.php.net/manual/en/book.simplexml.php >

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] function

2012-05-04 Thread tamouse mailing lists
On Thu, May 3, 2012 at 9:12 PM, Ron Piggott
 wrote:
> I need to access a FUNCTION I programmed within a different FUNCTION.  Are 
> these able to be passed like a variable?  Or are they able to become like a 
> $_SESSION variable in nature?  How am I able to do this?
>
> I am essentially programming:
>
> ===
> function name( $flag1, $flag2 ) {
>
> # some PHP
>
> echo name_of_a_different_function( $flag1 , $flag2 );
>
> }
> ===
>
> The error I am receiving is “Call to undefined function 
> name_of_a_different_function”

Where is name_of_a_different_function defined? If it is somewhere in
the same file as name, that shouldn't be a problem, provided it is
defined in the same namespace/scope as name. If it is defined in a
different file, you need to include that file before you make the echo
statement.

For example:

function func1 ($flag1, $flag2) {

   # blah blah

   echo func2($flag1, $flag2);
}

function func2 ($flag1, $flag2) {

   #blah blah

   return "some string value";
}

in the same file should be just fine. It doesn't really matter what
order func1 and func2 are declared in.

However, if func2 is defined in some_other_file.php, you need to
include it in this_file.php (where func1 is defined) first:

this_file.php:
include('some_other_file.php');

function func1 ($flag1, $flag2) {

   #blah blah

   echo func2 ($flag1, $flag2);
}


some_other_file.php:
function func2 ($flag1, $flag2) {

   #blah blah

   return "some string value";
}

If func2 is a method for an object/class, you'll have to access it
that way in func1:

this_file.php:
include('MyClass.php');
function func1 ($flag1, $flag2) {

   # blah blah, instantiate object?
   $myobj = new MyClass();

   echo $myobj->func2 ($flag1, $flag2);
}

MyClass.php:
class MyClass
{
   function func2 ($flag1, $flag2) {

  #blah blah
  return "some string value";
   }
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP & Emacs

2012-05-04 Thread tamouse mailing lists
On Fri, May 4, 2012 at 7:43 AM, Gerardo Benitez
 wrote:
> Hi Mihamina,
>
> I think that a few number of people use Emacs to write Php, in fact for
> proffesionals porpuse the people use a IDE for Php, like Netbeams, Eclipse
> PDT or Zend Studio.
>
> Regards,
> Gerardo
>
> On Wed, May 2, 2012 at 8:21 AM, Mihamina Rakotomandimby
> wrote:
>
>> Hi all,
>>
>> For curiosity, are there people here using Emacs to code in PHP?
>> What modes do you add? cedet, ecb,...
>>
>> I see (just for the example) that Drupal has a short documentation page
>> for Emacs http://drupal.org/node/59868
>>
>> Have you got some in your bookmarks for general PHP coding?
>>
>> --
>> RMA.
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
> --
> Gerardo Benitez
> -
> Programador Web Freelance

I use Emacs for editing practically everything. I use a
[php-mode.el](http://php-mode.sourceforge.net/) that is derived from
cc-mode, and works pretty well (except for one annoyance in that it
doesn't recognize octothorpes (#) for comment beginners :P). [Multiple
Major Modes](http://emacswiki.org/emacs/MultipleModes) is also pretty
helpful so you can edit files that mix PHP, HTML, JS, and CSS (which
is NOT a best practice, but sometimes necessary).

The [Emacs Wiki](http://emacswiki.org) seems to be the best place for
finding things in general, but is still not really as good as just
doing a google/bing/ddg search on what you're looking for. *Lots* of
people write about emacs, and there are generous tidbits all over.

Another thing I use heavily are snippets. The best package I've found
for this is the (Yet Another Snippets
mode)[https://github.com/capitaomorte/yasnippet] which speeds up
development quite a bit.

I have a (very limited) info page on Emacs on my wiki:
http://wiki.tamaratemple.com/Technology/Emacs (this is not
advertising; my server is small and won't handle a huge number of
hits; please don't /. it!)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Retrieve pages from an ASP driven site

2012-05-04 Thread tamouse mailing lists
On Wed, May 2, 2012 at 11:37 PM, EPA WC  wrote:
> Hi List,
>
> I am trying to write a crawler to go through web pages at
> http://www.freebookspot.es/CompactDefault.aspx?Keyword=. But I am not
> quite familiar with how asp uses _doPostBack function with the "next"
> button below the book list to advance to the next page. I hope someone
> who knows ASP well can help out here. I need to know how to retrieve
> next page with PHP code.
>
> Kind regards,
> Tom


Looking at that page source, I think this might be a bit problematic.

Notice that practically the whole page is inside a form. When you get
down to the "Next> " button, that is going to sumbmit the form with
it's appropriate fields set. If you look at the beginning of the form,
you'll see some interesting fields, one in particular, __VIEWSTATE is
pretty clearly an encoded value of some sort.

When your crawler parses the page, it will have to stash the field
values that the form sets in order to process the form correctly to
get the next page of entries by simulating a POST-data submit. This is
(probably?) most easily handled via libcurl.

Unsolicited advice: Many sites do not appreciate scraping activity;
make sure your crawler obeys robots.txt rules, and do not overtax the
site with crawler activity.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] function

2012-05-04 Thread Jim Giner
But the OP says "function is defined inside a different function".  Your 
theories to a solution don't fit that problem.
"tamouse mailing lists"  wrote in message 
news:cahuc_t-416_-lpcn3mo8qqxwrh4pnq5fmwouhwpdk+hmkgh...@mail.gmail.com...
On Thu, May 3, 2012 at 9:12 PM, Ron Piggott
 wrote:

Where is name_of_a_different_function defined? If it is somewhere in
the same file as name, that shouldn't be a problem, provided it is
defined in the same namespace/scope as name. If it is defined in a
different file, you need to include that file before you make the echo
statement.

For example:

function func1 ($flag1, $flag2) {

   # blah blah

   echo func2($flag1, $flag2);
}

function func2 ($flag1, $flag2) {

   #blah blah

   return "some string value";
}

in the same file should be just fine. It doesn't really matter what
order func1 and func2 are declared in.

However, if func2 is defined in some_other_file.php, you need to
include it in this_file.php (where func1 is defined) first:

this_file.php:
include('some_other_file.php');

function func1 ($flag1, $flag2) {

   #blah blah

   echo func2 ($flag1, $flag2);
}


some_other_file.php:
function func2 ($flag1, $flag2) {

   #blah blah

   return "some string value";
}

If func2 is a method for an object/class, you'll have to access it
that way in func1:

this_file.php:
include('MyClass.php');
function func1 ($flag1, $flag2) {

   # blah blah, instantiate object?
   $myobj = new MyClass();

   echo $myobj->func2 ($flag1, $flag2);
}

MyClass.php:
class MyClass
{
   function func2 ($flag1, $flag2) {

  #blah blah
  return "some string value";
   }
}

But the OP says "function is defined inside a different function".  Your 
theories to a solution don't fit that problem.

(Sorry you all had to read thru so much stuff just to get to my one-line 
response.) 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Running through an enormous SQL file

2012-05-04 Thread Brian Dunning
How would you launch that from PHP?

On May 4, 2012, at 6:11 PM, tamouse mailing lists wrote:

> Is there any need to use PHP with this at all? If it's already in SQL,
> can't you just feed it to mysql?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] get content rss feed

2012-05-04 Thread tamouse mailing lists
On Wed, May 2, 2012 at 7:00 AM, Doeke Wartena  wrote:
> I try to get the content from the following rss feed
> http://www.adafruit.com/blog/feed/
>
> I want to store it in a database in order to use it for a school assignment.
> If i look in my browser to the feed then i see content and description,
> however if i try to get them with php then description is this:
>
> [description] => SimpleXMLElement Object
>        (
>        )
>
>
> and content is gone.
>
>
> --
> $db = dbConnect();
>
> $xml =  getFileContents("http://www.adafruit.com/blog/feed/";);
> $xmlTree = new SimpleXMLElement($xml);
>
> for($i = count($xmlTree->channel->item)-1; $i >= 0; $i--) {
> $item = $xmlTree->channel->item[$i];
>  echo "";
> print_r($item);
> echo "";
> }
>
> dbClose($db);
>
> ?>
> --
>
> this is 1 part of the print_r:
>
> SimpleXMLElement Object
> (
>    [title] => Birth of the ARM: Acorn Archimedes Promo from 1987
>    [link] => 
> http://www.adafruit.com/blog/2012/04/28/birth-of-the-arm-acorn-archimedes-promo-from-1987/
>    [comments] =>
> http://www.adafruit.com/blog/2012/04/28/birth-of-the-arm-acorn-archimedes-promo-from-1987/#comments
>    [pubDate] => Sat, 28 Apr 2012 04:01:35 +
>    [category] => Array
>        (
>            [0] => SimpleXMLElement Object
>                (
>                )
>
>            [1] => SimpleXMLElement Object
>                (
>                )
>
>        )
>
>    [guid] => http://www.adafruit.com/blog/?p=30498
>    [description] => SimpleXMLElement Object
>        (
>        )
>
> )
>
> I guess content is gone cause it's like this:
>
> 
>
> And description is gone cause it's like this:
>
> 

Re: [PHP] Running through an enormous SQL file

2012-05-04 Thread tamouse mailing lists
Please put replies at BOTTOM

On Fri, May 4, 2012 at 9:24 PM, Brian Dunning  wrote:
> How would you launch that from PHP?
>
> On May 4, 2012, at 6:11 PM, tamouse mailing lists wrote:
>
>> Is there any need to use PHP with this at all? If it's already in SQL,
>> can't you just feed it to mysql?


It's a standard command you would launch via [exec or
shell_exec](http://us.php.net/manual/en/book.exec.php)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] function

2012-05-04 Thread tamouse mailing lists
On Fri, May 4, 2012 at 9:18 PM, Jim Giner  wrote:
> But the OP says "function is defined inside a different function".  Your
> theories to a solution don't fit that problem.
[snip]
> But the OP says "function is defined inside a different function".  Your
> theories to a solution don't fit that problem.
>
> (Sorry you all had to read thru so much stuff just to get to my one-line
> response.)

There's no need to include something if it turns out to be irrelevant.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] function

2012-05-04 Thread tamouse mailing lists
On Thu, May 3, 2012 at 9:12 PM, Ron Piggott
 wrote:
> I need to access a FUNCTION I programmed within a different FUNCTION.  Are 
> these able to be passed like a variable?  Or are they able to become like a 
> $_SESSION variable in nature?  How am I able to do this?
>
> I am essentially programming:
>
> ===
> function name( $flag1, $flag2 ) {
>
> # some PHP
>
> echo name_of_a_different_function( $flag1 , $flag2 );
>
> }
> ===
>
> The error I am receiving is “Call to undefined function 
> name_of_a_different_function”

Thanks to Jim, I understand a bit more, however, I still do not see
where name_of_a_different_function is being defined. Rather than
suppose something, please post the function where
name_of_a_different_function is defined.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] code deployment through php

2012-05-04 Thread tamouse mailing lists
On Wed, May 2, 2012 at 5:23 AM, rene7705  wrote:
> On Wed, May 2, 2012 at 11:47 AM, rene7705  wrote:
>
>> I can't use anything like git on my shared hoster. But I suppose I could
>> use something like git at home, and use a sync script like I posted in my
>> OP on the shared hoster.
>>
>>
>>
> Maybe you git gurus can help me along a bit further.
>
> I've managed to install msysgit and get it to work on my windows dev box,
> so far so good.
>
> Now, I'm wondering how to set up my repositories. The last cvs I used was
> Microsoft's visual source control back in the 90's, so I'm very rusty. At
> the same time, I'd prefer not to experiment too much..
>
> I've got a tree structure in a folder called simply "code", that I have in
> several locations on my windows box.
>
> Each site that I develop for has a folder in .../htdocs/sites/somedomain.com,
> and many of these sites will need a copy of the common "code" folder in
> them. I can restrict myself to developing in one domain's subdir only.
> The non-common code for each domain is designed to run from any
> $_SERVER['SERVER_NAME'] and any sub-directory it happens to be in. In other
> words, http://my-dev-box.biz/sites/somedomain.com/ will show the same thing
> from windowze as http://somedomain.com will from shared hosted linux.
>
> I would also like to version control the non-common code for each domain.
>
> And I would like to store the entire repository on my windows box at home
> in 2 or 3 specific locations (on seperate disks encrypted with truecrypt.org,
> and also a truecrypted usb disk, if and when that's plugged in).
>
> For distributing the common code to the shared hosted live server (my
> workflow is to check finalized changes on my win box against all my sites
> that used the common code base, before deploying to the shared hoster live
> server), I can simply FTP one finalized copy and use the simplest of rm -rf
> and cp -r commands in a short script to distribute the changes. I could
> even do without the PHP filesync code I posted earlier (altho it was fun to
> build! :)
>
> That darn hoster of mine won't support git on shared hosting, only on much
> more expensive virtual dedicated and dedicated plans :(
> But I've also found
> http://serverfault.com/questions/26836/setting-up-a-git-repo-on-my-godaddy-hosting-plan
>  and
> http://www.lyraphase.com/wp/uncategorized/how-to-build-git-for-a-host-with-no-compiler/
> that
> show me how I might get git running on my (kinda lame now) shared hosting
> account.
>
> Maybe a stupid question, but would perhaps copying the common code around
> with a simple script be faster than multiple pushes by git?


Using git, you can set up either publicly hosted repositories on
github.com or gitorious.org or perhaps other public repo places. If
you don't want you code to be publicly available, you can set up
private repositories as well.

Not being familiar with Windows implementations much at all, I can't
tell you specifically what to do with msysgit, so these will be more
generic instructions.

I'm going to assume you don't have a host somewhere with ssh access.
In this case you'll most likely want/need to set up your repository on
your local system. (Note that it isn't *strictly* necessary to have a
repository -- you can clone a new tree from the existing code tree,
however having a repository can ensure a clean code set in case your
working tree gets out of sync somehow.)

(These instructions are modified from
http://tumblr.intranation.com/post/766290565/how-set-up-your-own-private-git-server-linux
)

First, create a directory you want to hold all of your local
repositories (such as C:\User\rene\MyRepositories). Then create a
subdirectory off that to hold your server/application common code
(C:\Users\rene\MyRepositories\commoncode).

Make that directory (..\commoncode) a *bare* repository. (Not sure how
that's done with msysgit, but the basic git command is: "git init
--bare C:\Users\rene\MyRepositories\commoncode")

Then you add the repository as a remote to the working tree: git
remote add origin C:\Users\rene\MyRepositories\commoncode

Now you can push commits to your repository with the following sequence:

git add 
git commit
git push origin master

Now, to *deploy*, you can do the following:

Somewhere outside your working tree, create a directory called "deploy":

mkdir C:\Users\rene\deploy

Then clone your the repository of your commond code:

git clone C:\Users\rene\MyRepositories\commoncode cleancode-20120404

Then you can ftp the contents of cleancode-20120404 to your server as needed.

Sorry to be unable to tell you the exact steps with msysgit, but I
hope you can interpolate from the commands above.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php