[PHP] need loop help

2006-10-03 Thread Charles Kline

hi all.

i am trying to modify some old code and struggling a bit with this one:

// returns an array of the names in the form post
$fields = $_SESSION['case']-getComplaintKeys();

// here is the array returned
Array ( [0] = eligibility [1] = payment [2] = service [3] =  
document [4] = licensing [5] = source [6] = date [7] = contact  
[8] = description [9] = status )


for ($j = 0; $j  count($fields); $j++) {
  if (${$fields[$j]} == 'on') ${$fields[$j]} = 1;
  if (is_null(${$fields[$j]})) ${$fields[$j]} = 0;
  $data[$fields[$j]] = ${$fields[$j]};
}

The problem I am having is that the code is now on a more secure  
server with register_globals off (and I don't want to turn that on).


I am not sure how to get the POST data sorted out using this method.  
Hope it is clear what I mean.


Thanks,
Charles

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



[PHP] HAXPLORER - any info?

2006-03-30 Thread Charles Kline
My buddy just called me and let me know he found this running on his  
server.


I have googled it and come up with much, but it appears to be a php  
script that gives the user pretty much total control of adding,  
editing, deleting - files, folders, etc. As well as giving them  
access to run any shell script they want.


Does anyone know anything about this, and if they do - have any  
thoughts on how it may have gotten on the server and how to secure  
against it in the future? Just trying to help out a friend here.


Thanks,
Charles

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



Re: [PHP] HAXPLORER - any info?

2006-03-30 Thread Charles Kline
Turned out to be a security hole in Mambo. He has fixed it. Thanks  
for your assistance.


- Charles

On Mar 30, 2006, at 3:33 PM, Brady Mitchell wrote:


-Original Message-
Does anyone know anything about this, and if they do - have any
thoughts on how it may have gotten on the server and how to secure
against it in the future? Just trying to help out a friend here.


Without knowing the exact setup of the server, we can't help much.   
Any

service running on the system that allows people to access the system
could be the culprit, or it could be weak passwords on the server, it
could even be a piece of poorly written php code that allowed  
someone to

get control.

I would suggest that your friend make a list of the things he has
running on his server and spend some time googling for security issues
with those services/programs.

Brady


--
RightCode, Inc.
900 Briggs Road #130
Mount Laurel, NJ 08054
P: 856.608.7908
F: 856.439.0154
E: [EMAIL PROTECTED]

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



[PHP] Accessing data in an object?

2005-09-27 Thread Charles Kline
I am confused on how to get to the data in this object, anyone help  
me out?


here is the result of my var_dump() which is inside a class function  
functionTest($data){ var_dump($data); }


object(staff)(2) {
  [arrStaff]=
  array(12) {
[bsStaffID]=
string(4) 9090
[bsLastName]=
string(5) kline
[bsFirstName]=
string(7) charles
[bsPhone]=
string(4) 1212
[bsSite]=
string(1) 4
[bsCube]=
string(4) 1212
[bsEmail]=
string(6) klinec
[bp_boOrgID]=
NULL
[bpPositionID]=
NULL
[ptTitleName]=
NULL
[bp_ptTitleID]=
NULL
[bpVacantDate]=
NULL
  }
  [created]=
  int(0)
}

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



Re: [PHP] Accessing data in an object?

2005-09-27 Thread Charles Kline


On Sep 27, 2005, at 12:07 PM, Charles Kline wrote:

I am confused on how to get to the data in this object, anyone help  
me out?


here is the result of my var_dump() which is inside a class  
function functionTest($data){ var_dump($data); }


object(staff)(2) {
  [arrStaff]=
  array(12) {
[bsStaffID]=
string(4) 9090
[bsLastName]=
string(5) kline
[bsFirstName]=
string(7) charles
[bsPhone]=
string(4) 1212
[bsSite]=
string(1) 4
[bsCube]=
string(4) 1212
[bsEmail]=
string(6) klinec
[bp_boOrgID]=
NULL
[bpPositionID]=
NULL
[ptTitleName]=
NULL
[bp_ptTitleID]=
NULL
[bpVacantDate]=
NULL
  }
  [created]=
  int(0)
}




Nevermind... I got it :)

echo $s-arrStaff['bsLastName'];

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



[PHP] Two MySQL connections in one script not working as expected

2005-09-27 Thread Charles Kline

Hi all,

I have a script that needs to update data in two databases. My db  
connections are both in class files that I created to execute the  
various connections and queries.


What is happening is that the second database connection does not  
seem to work. The error I get is that it seems the second query is  
being executed against the first database connection - does that make  
sense? So I get an error that the database_name.table_name does not  
exist, which is true, but the query is getting executed against the  
wrong database name.


Any ideas?

Thanks,
Charles

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



Re: [PHP] Two MySQL connections in one script not working as expected

2005-09-27 Thread Charles Kline


On Sep 27, 2005, at 3:42 PM, Andy Pieters wrote:



Hi

Without you actually showing us these class files we can only guess  
but a

common mistake is this:

mysql_open(connection details)
mysql_query(query)

In those cases the last opened handle is used.  To prevent this,  
use this

syntax

$db1=mysql_open(connection for db1);
$db2=mysql_open(connection for db2);

mysql_query($db1,$query_db_1);
mysql_query($db2,$query_db_2);

If you have used this syntax then check your class if it is using a  
global
variable to hold the database handle and if it does make it a class  
variable

instead

Instead of

$db=null

class db
{function db()
 {$GLOBALS['db']=mysql_open(...

do instead

class db
{var $db=null;
 function db()
 {$this-db=mysql_open

That way you can instanciate as many instances of the class as you  
like and

each will have its own database handle.

HTH


Andy




What I have is more like this:

class db {
  var $dbpath = localhost;
  var $dbname = testdb;
  var $dblogin = test;
  var $dbpass = test;

  function db() {
$link = mysql_connect($this-dbpath, $this-dblogin, $this- 
dbpass) or die ('Not Connected: ' . mysql_error());
mysql_select_db($this-dbname, $link) or die ('Can\'t use this  
database: ' . mysql_error());

  }

  function retrieveData( $sql ) {
$rs = mysql_query( $sql ) or die(Invalid query:  . mysql_error 
());

// if no result, return null
if (($rs == null) || (mysql_num_rows($rs) == 0)) {
  return null;
} else {
  return ( $rs );
}
  }

  function insertData( $sql ) {
mysql_query( $sql );
// return new id if insert is successful
if ( mysql_affected_rows()  0 ) {
  return ( mysql_insert_id() );
} else {
  return null;
}
  }

  function updateData( $sql ) {
$rs = mysql_query( $sql );
if (mysql_affected_rows()  0) {
  return ( $rs );
} else {
  return null;  // no changes were made
}
  }
}


I then have another class with a different name and I changed the  
names of the functions as well. I have another set of class files  
that contain my various queries etc.


Thanks for any help.
Charles

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



Re: [PHP] Two MySQL connections in one script not working as expected

2005-09-27 Thread Charles Kline


On Sep 27, 2005, at 5:23 PM, M. Sokolewicz wrote:


Charles Kline wrote:



On Sep 27, 2005, at 3:42 PM, Andy Pieters wrote:


Hi

Without you actually showing us these class files we can only  
guess  but a

common mistake is this:

mysql_open(connection details)
mysql_query(query)

In those cases the last opened handle is used.  To prevent this,   
use this

syntax

$db1=mysql_open(connection for db1);
$db2=mysql_open(connection for db2);

mysql_query($db1,$query_db_1);
mysql_query($db2,$query_db_2);

If you have used this syntax then check your class if it is using  
a  global
variable to hold the database handle and if it does make it a  
class  variable

instead

Instead of

$db=null

class db
{function db()
 {$GLOBALS['db']=mysql_open(...

do instead

class db
{var $db=null;
 function db()
 {$this-db=mysql_open

That way you can instanciate as many instances of the class as  
you  like and

each will have its own database handle.

HTH


Andy




What I have is more like this:
class db {
  var $dbpath = localhost;
  var $dbname = testdb;
  var $dblogin = test;
  var $dbpass = test;
  function db() {
$link = mysql_connect($this-dbpath, $this-dblogin, $this-  
dbpass) or die ('Not Connected: ' . mysql_error());
mysql_select_db($this-dbname, $link) or die ('Can\'t use  
this  database: ' . mysql_error());

  }
  function retrieveData( $sql ) {
$rs = mysql_query( $sql ) or die(Invalid query:  .  
mysql_error ());

// if no result, return null
if (($rs == null) || (mysql_num_rows($rs) == 0)) {
  return null;
} else {
  return ( $rs );
}
  }
  function insertData( $sql ) {
mysql_query( $sql );
// return new id if insert is successful
if ( mysql_affected_rows()  0 ) {
  return ( mysql_insert_id() );
} else {
  return null;
}
  }
  function updateData( $sql ) {
$rs = mysql_query( $sql );
if (mysql_affected_rows()  0) {
  return ( $rs );
} else {
  return null;  // no changes were made
}
  }
}
I then have another class with a different name and I changed the   
names of the functions as well. I have another set of class files   
that contain my various queries etc.

Thanks for any help.
Charles

that's where it's going wrong. You're not linking db::db()'s link  
in the db::insertData() mysql_query() function. Thus, the  
mysql_query function defaults to the last opened mysql connection  
regardless of object. A way to fix this is to store the link in  
$this-link instead, and changing your mysql_query()'s to  
mysql_query($sql, $this-link);
same goes for your mysql_affected_rows() and mysql_insert_id()  
functions


-tul



Hmm... still getting the same results. Here is my modified class files:

class db {
  // database setup.  These should be changed accordingly.
  var $dbpath = localhost;
  var $dbname = blah1;
  var $dblogin = test;
  var $dbpass = test;


  function db() {
$this-link = mysql_connect($this-dbpath, $this-dblogin, $this- 
dbpass) or die ('Not Connected: ' . mysql_error());
mysql_select_db($this-dbname, $this-link) or die ('Can\'t use  
this database: ' . mysql_error());

  }

  function retrieveData( $sql ) {
$rs = mysql_query( $sql,$this-link ) or die(Invalid query:  .  
mysql_error());

// if no result, return null
if (($rs == null) || (mysql_num_rows($rs) == 0)) {
  return null;
} else {
  return ( $rs );
}
  }

  function insertData( $sql ) {
mysql_query( $sql,$this-link );
// return new complaint id if insert is successful
if ( mysql_affected_rows($this-link)  0 ) {
  return ( mysql_insert_id($this-link) );
} else {
  return null;
}
  }

  function updateData( $sql ) {
$rs = mysql_query( $sql,$this-link );
if (mysql_affected_rows($this-link)  0) {
  return ( $rs );
} else {
  return null;  // no changes were made
}
  }
}

and stored in another file...

class db2 {
  // database setup.  These should be changed accordingly.
  var $dbpath = localhost;
  var $dbname = blah2;
  var $dblogin = test;
  var $dbpass = test;


  function dbzen() {
$this-link = mysql_pconnect($this-dbpath, $this-dblogin,  
$this-dbpass) or die ('Not Connected: ' . mysql_error());
mysql_select_db($this-dbname, $this-link) or die ('Can\'t use  
this database: ' . mysql_error());


  }

  function retrieveZenData( $sql ) {
$rs = mysql_query( $sql,$this-link ) or die(Invalid query:  .  
mysql_error());

// if no result, return null
if (($rs == null) || (mysql_num_rows($rs) == 0)) {
  return null;
} else {
  return ( $rs );
}
  }

  function insertZenData( $sql ) {
mysql_query( $sql,$this-link ) or die(Invalid query:  .  
mysql_error());

// return new complaint id if insert is successful
if ( mysql_affected_rows($this-link)  0 ) {
  return ( mysql_insert_id($this-link) );
} else {
  return null;
}
  }

  function updateZenData( $sql ) {
$rs = mysql_query( $sql,$this-link

[PHP] Handling file uploads for download

2005-09-12 Thread Charles Kline

Hi all,

I have an application where I need to allow the admin of a site to  
upload PDF files for download by their clients.


I am uploading files to a directory ABOVE the web root, but I have no  
clue what the best way to have a link on the site to allow for  
downloading those files by visitors twould be.


Any suggestions?

Thanks,
Charles

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



[PHP] extending a class using includes not working

2005-05-25 Thread Charles Kline

hi all.

i have 2 class files. say for example.

class 1

class 2 extends class 1

class 2  uses include_once(firstclass.php)

then i use include_once (secondclass.php) in my template. this does  
not work. to get it to work, i must put both the files as includes in  
my template.

any ideas why?

thanks,
charles

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



Re: [PHP] extending a class using includes not working

2005-05-25 Thread Charles Kline


On May 25, 2005, at 7:53 PM, Richard Lynch wrote:


On Wed, May 25, 2005 11:30 am, Charles Kline said:


i have 2 class files. say for example.

class 1

class 2 extends class 1

class 2  uses include_once(firstclass.php)

then i use include_once (secondclass.php) in my template. this does
not work. to get it to work, i must put both the files as includes in
my template.
any ideas why?



Could you define does not work a little more precisely?

Do you get error messages?

What do the error messages say?

Is there any output at all?

Does your computer blow up?

What?



Sorry I should have been more specific (or course)...

The template does not load. I get no error messages of any kind. Both  
classes function fine when included into the template separately -  
but when in include the secondclass.php which in turn includes  
firstclass.php the page does not load.


Running on Mac OS X Server version 10.3

- Charles

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



[PHP] Recursive function and formatting string for javascript tree

2005-05-24 Thread Charles Kline

Hi all.

I can't seem to figure this one out. I am trying to output a string  
for a javascript that builds a DHTML tree. The sample string looks  
like this:


[
['Executive Director', null, null,
['Executive Assistant ', null, null],
['Operations Director', null, null,
['Information Technology Director', null, null,
['Information Technology Analyst', null, null]
]
],
['Finance Director', null, null],
['Human Resources Director', null, null],
['Program Services Director', null, null]
]
]

My class contains these two functions to make this happen:

function generateOrg() {
$this-getDepts(0,1);
$str = [. $this-str.];
return ($str);
}

function getDepts ( $parent, $level ) {
$sql = 'SELECT BudgetedOrganization.* ';
$sql .= 'FROM BudgetedOrganization ';
$sql .= 'WHERE BudgetedOrganization.boSuperiorOrgID = ' .  
$parent;


$rs = $this-retrieveData($sql);
$totalRows = mysql_num_rows($rs);
if ($totalRows  0)
{
while($row = mysql_fetch_array($rs)){
$currRow = 0;
$this-str .= [' . $row['boOrgName'] . ',null,null;

($totalRows == $currRow) ? $delim = , : $delim =  
],;


$this-str .= $delim;
$this-getDepts($row['boOrgID'],$level+1);
$currRow++;

}
}

return($this-str);
}


Here is the output I am getting from my database, and the format is  
not right. I have played with it for hours and still can't figure out  
how to get the brackets and commas formatted properly to represent  
the data tree properly.


['Organization XYZ',null,null],
['Operations',null,null],
['Finance',null,null],
['Information Technology',null,null],
['Program Services',null,null],
['Program Support',null,null],
['Provider Resources',null,null],
['MOST',null,null],
['Family Resources',null,null],
['Family Resources - Chatham Site',null,null],
['Team 13',null,null],
['Team 14',null,null],
['Enhanced Programs',null,null],
['Teen Parent Program',null,null],
['External Relations',null,null],

]

AND here is is when it is nested the way I want it (I did this by hand):

[
['Organization XYZ',null,null,
['Operations',null,null,
['Finance',null,null],
['Information Technology',null,null]
],
['Program Services',null,null,
['Program Support',null,null]
['Provider Resources',null,null,
['MOST',null,null]
],
['Family Resources',null,null,
['Family Resources - Chatham Site',null,null,
['Team 13',null,null],
['Team 14',null,null]
],
['Enhanced Programs',null,null,
['Teen Parent Program',null,null]
]
],
],
['External Relations',null,null]
]
]


Any help would be great. I am stuck.

Thanks,
Charles

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



[PHP] Class function calling another function in class

2005-05-18 Thread Charles Kline
Hi all,
Not sure if I am doing this right and I can't figure it out, was  
hoping someone here can help.

I have an organization table in mySQL. Pretty standard. My first  
function getDepts() is working as I intend and returning the tree  
just as I like it. The new piece I added in there that is not working  
now is the call to getPositions() within the first function. What I  
am trying to do is once I get a Department, I want to loop through  
the Positions table and get the positions that are under that  
Department. This code goes haywire and loops for ever printing a huge  
list to the screen. Eventually I need to return this data not to the  
screen but into an array. Anyone see what I might have wrong in my  
logic?

I have a class and it contains these two functions.
function getDepts ( $parent = 0, $level = 1 ) {
$sql = 'SELECT BudgetedOrganization.* ';
$sql .= 'FROM BudgetedOrganization ';
$sql .= 'WHERE BudgetedOrganization.boSuperiorOrgID = ' .  
$parent;

$rs = $this-retrieveData($sql);
if ($rs)
{
while($row = mysql_fetch_array($rs)){
$num = 1;
while ($num = $level) {
$this-str .= \t;
$num++;
}
$this-str .= $row['boOrgID'] . ,  . $row 
['boOrgName'] . \n;

   // just added this and it ain't working
$this-str .= $this-getPositions($row['boOrgID']);
$this-getDepts($row['boOrgID'],$level+1);
}
}
return($this-str);
}
function getPositions ( $org = 0 ) {
$sql = 'SELECT BudgetedPosition.* ';
$sql .= 'FROM BudgetedPosition ';
$sql .= 'WHERE BudgetedPosition.bp_boOrgID = ' . $org;
//echo $sql;
$rs = $this-retrieveData($sql);
if ($rs)
{
while($row = mysql_fetch_array($rs)){
$this-str .=  -  . $row['bpPositionID'] . \n;
}
}
return($this-str);
}
Later
$depts = $org-getDepts();
echo pre . $depts . /pre;
Thanks,
Charles
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP Cached Templates

2004-08-31 Thread charles kline
On Aug 31, 2004, at 9:18 PM, raditha dissanayake wrote:
rogue wrote:
Sorry if this is the wrong place for this post. I am having problems 
where PHP templates that I modify via ftp are not showing changes for 
like 1 minute or so. I assume this is some kind of server caching but 
I am not sure how to adjust this (it is my development server). 
Running Apache server.
It could well be a caching issue are you working behind a proxy? what 
are your browser cache settings?

No proxy, and I don't have any caching issues with my production 
server. Guess I will keep searching :)

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


Re: [PHP] Techniques for doing story

2004-08-17 Thread charles kline
I understand how the pages are designed etc. What I wanted to 
understand better was how the pages were being displayed using PHP. I 
guess it is obvious now after getting a few responses, that the HTML is 
stored in a table, perhaps one record per page... then you just query 
the story_id and page through the records. Guess it isn't that 
mysterious after all ;)


On Aug 17, 2004, at 12:18 PM, Matthew Sims wrote:
Hi all,
I want to do something like this:
http://www.cgnetworks.com/story_custom.php?story_id=2259corresponding
Where we can publish an article, multiple page even and lay it out in 
a
nice design with images etc. How do you think this is done?
Uh...HTML? It is a website, correct?
These stories are dynamically generated it seems since the page is
passed in the URL. I am just not sure where to start...
Thanks,
Rogue
PHP has nothing to do with the layout. The story is probably stored in 
a
database and the story_id var is passed through $_GET to pull up the
cooresponding story.

Learn HTML and CSS and you can make a website look however you want it 
to
look. PHP simply makes the pages change depending on user events.

--
--Matthew Sims
--http://killermookie.org
--
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


Re: [PHP] Techniques for doing story

2004-08-17 Thread charles kline
Yea, But then I took his advice and found this 
http://www.catb.org/~esr/faqs/smart-questions.html#keepcool so I was 
not so offended :)

I had all the other links, but that one and did not think my question 
was that out there for the list... oh well.

On Aug 17, 2004, at 12:31 PM, Jason Davidson wrote:
Friendly crew today. :)
Jason
John Nichel [EMAIL PROTECTED] wrote:
rogue wrote:
Hi all,
I want to do something like this:
http://www.cgnetworks.com/story_custom.php?story_id=2259
Where we can publish an article, multiple page even and lay it out 
in a
nice design with images etc. How do you think this is done? These
stories are dynamically generated it seems since the page is passed 
in
the URL. I am just not sure where to start...
First : http://vzone.virgin.net/sizzling.jalfrezi/iniframe.htm
Second : http://us4.php.net/manual/en
Third : http://dev.mysql.com/doc/mysql/en/index.html
And before you come to a mailing list
http://www.google.com
http://groups.google.com
http://marc.theaimsgroup.com
http://www.catb.org/~esr/faqs/smart-questions.html
RTFM
STFW
STFA
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Techniques for doing story

2004-08-17 Thread charles kline
On Aug 17, 2004, at 1:04 PM, Matthew Sims wrote:
snip
hn C. Nichel
OMG, John. You broke through to someone. This could be good sign. Now 
if
we can just get him to stop top posting he'll be ready for anything. ;)

/snip
oops... now i got it! :)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Working with a new design client

2004-08-09 Thread charles kline
Hi all,
I have a new client (a design company). They have never developed a 
dynamic website at all and do all their HTML editing using Dreamweaver.

When I build sites, I am used to using a class for pages. Many of the 
pages in this site are totally static except for a few elements (Bread 
Crumb, Nav Bar, etc.). So I am not sure if this method is the best way 
to go...

My big concern is that I am going to totally screw them up if they want 
to edit some details on a page, they are going to have to go in and 
mess with the HTML that gets passed to the drawPage() function. Maybe 
there is a better way to handle this?

I have never used Smarty, which I understand might be a big help in 
these situations. One concern of mine is that I have a tight budget on 
this project and don't want to spend a lot of time learning a new 
system unless I have to.

Thanks for any advice,
Charles
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] CMS Ideas Welcome

2004-08-04 Thread charles kline
Hi all,
I could use some advice/pointers on a sold method for achieving this 
feature on a site I am building. One of the features is an event 
calendar. The events are listed by date, not in a calendar view, but a 
list with a short description of the event. This part is no problem. 
What I am not sure about as far as a best method is the next part. 
Each event could have a longer description. The client wants to be able 
to style this longer description using formatting and images, but does 
not want to have to code the HTML into a textarea and then upload the 
images via ftp or whatever. The idea I came up with is to have a few 
pre-defined layouts they can choose from. Some of which could 
incorporate some images. Once the style is picked and the text is 
entered (different fields get different styles applied) the submit the 
data, and if the style makes images a part of the layout, I give them a 
form based image upload feature. Another thought was to have them 
upload .html files and the images via a form, but then I thought this 
could really cause problems if they had screwed up code.

Any thoughts would be greatly appreciated.
Thanks,
Charles
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Finding a value in an array

2004-07-22 Thread charles kline
Hi all,
I am using fgetcsv() to get a tab delimited text file into an array. It 
gives me an array in this format:

Array
(
[0] = Array
(
[0] = 97
[1] = Effects of Slow Heating Rates on Products of 
Polyethylene Pyrolysis
)

[1] = Array
(
[0] = 103
[1] = Effect of Heating Rate of Oxidative Degradation of 
Polymeric Materials
)

[2] = Array
(
[0] = 106
[1] = Identification and Differentiation of Synthetic 
Polymers by Pyrolysis Capillary Gas Chromatography
)
)

From a form, I am passing in some values from checkboxes like:
input type=checkbox name=notes[] value=97 /
input type=checkbox name=notes[] value=106 /
I need to be able to display the description string in the array for 
whichever checkboxes are checked. So for example if the user submits 
the form with the value 106 I want to display Identification and 
Differentiation...

Any ideas? Please copy me on replies.
Thanks,
Rogue
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Finding a value in an array

2004-07-22 Thread charles kline
Thanks!!!
On Jul 22, 2004, at 11:39 PM, Justin Patrin wrote:
On Thu, 22 Jul 2004 23:34:56 -0400, charles kline 
[EMAIL PROTECTED] wrote:
Hi all,
I am using fgetcsv() to get a tab delimited text file into an array. 
It
gives me an array in this format:

Array
(
 [0] = Array
 (
 [0] = 97
 [1] = Effects of Slow Heating Rates on Products of
Polyethylene Pyrolysis
 )
 [1] = Array
 (
 [0] = 103
 [1] = Effect of Heating Rate of Oxidative Degradation of
Polymeric Materials
 )
 [2] = Array
 (
 [0] = 106
 [1] = Identification and Differentiation of Synthetic
Polymers by Pyrolysis Capillary Gas Chromatography
 )
)
 From a form, I am passing in some values from checkboxes like:
input type=checkbox name=notes[] value=97 /
input type=checkbox name=notes[] value=106 /
I need to be able to display the description string in the array for
whichever checkboxes are checked. So for example if the user submits
the form with the value 106 I want to display Identification and
Differentiation...
Any ideas? Please copy me on replies.
Just loop through and check...
foreach($csvArray as $entry) {
  if(in_array($entry[0], $_REQUEST['notes'])) {
echo $entry[1].'br/;
  }
}
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--
--
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


[PHP] PHP Coding Standards

2004-05-29 Thread charles kline
Hi all,
I was having a conversation with a friend and talking about coding 
standards in the open source community (focusing on PHP). I seem to 
remember there being a document out there that sort of laid it out 
pretty well.

Anyone know where I might find a copy?
Thanks,
Charles
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Shopping Cart Solutions

2003-09-22 Thread Charles Kline
Anyone have suggestions for open source shopping cart apps in PHP?

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


[PHP] PHP and Palm

2003-09-16 Thread Charles Kline
I have a project in mind where I would like to be able to Sync my Palm 
with the calendar in my CRM. Anyone have info on doing this?

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


Re: [PHP] Encrypt/Serialize Source Code for Sale

2003-09-07 Thread Charles Kline
Thanks. This is one I had not turned up in my search. Much appreciated.

- Charles

On Sunday, Sep 7, 2003, at 00:44 US/Eastern, Evan Nemerson wrote:

Take a look at Turck MMCache (free) and Zend Encoder (not).

http://www.turcksoft.com/en/e_mmc.htm
http://www.zend.com/store/products/zend-encoder.php


On Saturday 06 September 2003 01:59 pm, Charles Kline wrote:
What methods are available (ups and downs) for encrypting and
serializing php applications for sale?
Thanks,
Charles
--
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


[PHP] Encrypt/Serialize Source Code for Sale

2003-09-06 Thread Charles Kline
What methods are available (ups and downs) for encrypting and 
serializing php applications for sale?

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


Re: [PHP] stripping newlines from a string

2003-06-09 Thread Charles Kline
Yes. Is weird. I thought this would work too, but for some reason it 
was not removing them all. I wonder if re-saving the files with UNIX 
linebreaks (or try DOS) would have any effect. Will report back.

- Charles

On Monday, June 9, 2003, at 02:24 AM, Joe Pemberton wrote:

http://www.php.net/str_replace

$newstr = str_replace(\n, , $oldstr);

- Original Message -
From: Charles Kline [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, June 08, 2003 10:44 PM
Subject: [PHP] stripping newlines from a string

Hi all,

How would i go about stripping all newlines from a string?

Thanks,
Charles
--
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


[PHP] reading a file into variable for using in a javascript

2003-06-08 Thread Charles Kline
Hi all,

I am reading the content of a text file into a variable to be used in a 
javascript. I am reworking some code that was originally done using 
ColdFusion and the jsStringFormat(var) function. What is the PHP 
equivalent string function? Is there one? I have searched the docs, but 
can't figure out which to use.

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


[PHP] stripping newlines from a string

2003-06-08 Thread Charles Kline
Hi all,

How would i go about stripping all newlines from a string?

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


[PHP] When to use a text file rather then a database

2003-04-05 Thread Charles Kline
Hello all,

I have a text blurb that is on the home page of a site. I need to make 
this block of text editable through a form in  the admin section of the 
site. Is it worth having a table in the db or would I be better off 
writing to a file for this?

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


[PHP] getting values from objects

2003-04-01 Thread Charles Kline
hi there,

if this:

$res_pform-getSubmitValue(investigator5);

returns an array, how do I get to the individual values in that array 
without first setting it to a variable like:

$myvar = $res_pform-getSubmitValue(investigator5);

echo $myvar['field'];

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


Re: [PHP] getting values from objects

2003-04-01 Thread Charles Kline
My objective was to try and NOT use a temporary variable.

for example I can do this:

foreach ($res_pform-getSubmitValue(investigator5) AS $k=$v){
echo $k . br;
}
I was just wondering in other circumstances, how I can maybe just get 
to the value of one of the keys without setting it first to a variable 
(which is the only way I know how to now).

Thanks,
Charles
On Tuesday, April 1, 2003, at 03:18 PM, Dan Joseph wrote:

Have you tried:

extract ($myvar = $res_pform-getSubmitValue(investigator5));

-Dan Joseph

-Original Message-
From: Charles Kline [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 01, 2003 2:58 PM
To: [EMAIL PROTECTED]
Subject: [PHP] getting values from objects
hi there,

if this:

$res_pform-getSubmitValue(investigator5);

returns an array, how do I get to the individual values in that array
without first setting it to a variable like:
$myvar = $res_pform-getSubmitValue(investigator5);

echo $myvar['field'];

thanks
charles
--
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


Re: [PHP] Validate MySQL date

2003-03-31 Thread Charles Kline
try the checkdate() function. i think that will do what you need.

On Monday, March 31, 2003, at 11:06 PM, Ben C. wrote:

How do I easily check to see if a MySQL formatted date is valid such  
as if a
user enters

2003/02/28 would return true
2003/02/31 would return false
I have check the manual and other resources but can't come up with  
anything.

--- 
---
The content of this email message and any attachments are confidential  
and
may be legally privileged, intended solely for the addressee.  If you  
are
not the intended recipient, be advised that any use, dissemination,
distribution, or copying of this e-mail is strictly prohibited.  If you
receive this message in error, please notify the sender immediately by  
reply
email and destroy the message and its attachments.

--
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


[PHP] date math question

2003-03-27 Thread Charles Kline
I am storing my dates as unix timestamp (epoch). Am I right in assuming 
that if I need to add or subtract days from this it is done in seconds?

So for example if I have the timestamp 1041397200 and I wanted to 
subtract 24 hours from it I would do this:

$newtime = $orig_time - 86400;

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


Re: [PHP] date math question

2003-03-27 Thread Charles Kline
Okay cool.

This leads me to another question. If I have stored the date as an 
epoch then is there a way using PHP and MySQL to say find all the 
records that have been added this YEAR (not last 365 days)?

Thanks
Charles
On Friday, March 28, 2003, at 12:31 AM, Leo Spalteholz wrote:

On March 27, 2003 09:15 pm, Charles Kline wrote:
I am storing my dates as unix timestamp (epoch). Am I right in
assuming that if I need to add or subtract days from this it is
done in seconds?
yes

--
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


Re: [PHP] date math question

2003-03-27 Thread Charles Kline
Caught that :) Thanks for the tip... worked just perfect (after I fixed 
typo)

On Friday, March 28, 2003, at 12:57 AM, Foong wrote:

sorry
typo error should be:
date('Y')

Foong

Foong [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
hi,

$start = mktime ( 0, 0, 0, 1, 1, date['Y']);  // first day of this 
year
$end = mktime ( 0, 0, 0, 12, 31, date['Y']);  // last day of this year

then select all record where timestamp = $start and timestamp = $end

should do the job
Hope this helps
Foong



Charles Kline [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Okay cool.

This leads me to another question. If I have stored the date as an
epoch then is there a way using PHP and MySQL to say find all the
records that have been added this YEAR (not last 365 days)?
Thanks
Charles
On Friday, March 28, 2003, at 12:31 AM, Leo Spalteholz wrote:

On March 27, 2003 09:15 pm, Charles Kline wrote:
I am storing my dates as unix timestamp (epoch). Am I right in
assuming that if I need to add or subtract days from this it is
done in seconds?
yes

--
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


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


[PHP] html_quickform - array question

2003-03-26 Thread Charles Kline
hi all,

using html_quickform (pear) and it has a date type that passes the date 
info like this:

array(24) {
  [lr_pub_date]=
  array(3) {
[m]=
string(1) 3
[d]=
string(2) 12
[Y]=
string(4) 2003
  }
I am used to getting this data like:

$form-getSubmitValue(field_name);

But doing that with this array just returns: Array

Anyone know how to get to the data?

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


Re: [PHP] html_quickform - array question

2003-03-26 Thread Charles Kline
Okay. I think I understand. So I do something like this:

$thedate = $lr_form-getSubmitValue('lr_pub_date');

echo The month: $thedate['m'];

Is that what you meant?

- Charles

On Wednesday, March 26, 2003, at 09:31 PM, Leif K-Brooks wrote:

Are you trying to print/echo it? That converts it to a string first. 
Either print_r it, var_dump it, or do something else with it.

Charles Kline wrote:

hi all,

using html_quickform (pear) and it has a date type that passes the 
date info like this:

array(24) {
  [lr_pub_date]=
  array(3) {
[m]=
string(1) 3
[d]=
string(2) 12
[Y]=
string(4) 2003
  }
I am used to getting this data like:

$form-getSubmitValue(field_name);

But doing that with this array just returns: Array

Anyone know how to get to the data?

Thanks
charles

--
The above message is encrypted with double rot13 encoding.  Any 
unauthorized attempt to decrypt it will be prosecuted to the full 
extent of the law.



--
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


Re: [PHP] html_quickform - array question

2003-03-26 Thread Charles Kline
Great. Thanks.

- Charles

On Wednesday, March 26, 2003, at 09:48 PM, Leif K-Brooks wrote:

Yes, but you can't put put the single quoted array key directly in the 
double-quotes string, try:

$thedate = $lr_form-getSubmitValue('lr_pub_date');

echo The month: {$thedate['m']};

Charles Kline wrote:

Okay. I think I understand. So I do something like this:

$thedate = $lr_form-getSubmitValue('lr_pub_date');

echo The month: $thedate['m'];

Is that what you meant?

- Charles

On Wednesday, March 26, 2003, at 09:31 PM, Leif K-Brooks wrote:

Are you trying to print/echo it? That converts it to a string first. 
Either print_r it, var_dump it, or do something else with it.

Charles Kline wrote:

hi all,

using html_quickform (pear) and it has a date type that passes the 
date info like this:

array(24) {
  [lr_pub_date]=
  array(3) {
[m]=
string(1) 3
[d]=
string(2) 12
[Y]=
string(4) 2003
  }
I am used to getting this data like:

$form-getSubmitValue(field_name);

But doing that with this array just returns: Array

Anyone know how to get to the data?

Thanks
charles

--
The above message is encrypted with double rot13 encoding.  Any 
unauthorized attempt to decrypt it will be prosecuted to the full 
extent of the law.



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


--
The above message is encrypted with double rot13 encoding.  Any 
unauthorized attempt to decrypt it will be prosecuted to the full 
extent of the law.



--
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


[PHP] formatting textarea input on output

2003-03-25 Thread Charles Kline
hi all,

i have a textarea in a form which gets inserted into a table in my 
database (mySQL). When displaying this text back to the screen, how do 
i retain the line breaks etc. that were in the original input?

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


Re: [PHP] MySQL and phpMyAdmin Issues

2003-03-25 Thread Charles Kline
I am by no means an expert (even remotely) but I do recall instructions 
on exactly how to do this in the documentation for MySQL - I think 
under the how to upgrade section.

- Charles

On Monday, March 3, 2003, at 06:53 PM, Stephen Craton wrote:

Hello,

Yesturday I made a big mistake. I had to import a 60MB file into a 
database
and I used ssh. I'm very unfamiliar with it and when I connected to the
MySQL connection thing, I forgot to switch databases when I imported. 
This
overwrite (I don't know why but it did) the users table in the mysql
database and caused everything to get messy.

For some reason, though, the sites on the server are still working with
their old MySQL username and password (I'm not sure why since I 
imported a
fresh install's mysql database from my local server). Everything seems 
to be
working except phpMyAdmin. When I try logging in using the default 
user as
root and password as nothing, it gives me an access denied error. It 
does
this for every user we had in the database as well. Is there anyway I 
can
fix this is ssh? The only option I can think of is reinstalling MySQL 
but
even then we'll loose all the old databases and I'm not sure how to 
export
the tables to a file in ssh.

Any help here would be most obliging and I need a reply rather 
urgently in
order to allow my hosted sites access to phpMyAdmin once again...

Thanks,
Stephen Craton
http://www.melchior.us
--
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


Re: [PHP] formatting textarea input on output

2003-03-25 Thread Charles Kline
I hang my head in shame... yes. As a matter of fact, I did on my second 
skim through my PHP ref. manual... thanks for the pointer just the same.

- charles

On Tuesday, March 25, 2003, at 05:38 PM, CPT John W. Holmes wrote:

i have a textarea in a form which gets inserted into a table in my
database (mySQL). When displaying this text back to the screen, how do
i retain the line breaks etc. that were in the original input?
I bet if you searched for textarea and line breaks you'd of found 
the
nl2br() function... but I'm not a betting man... unless there's money
involved... and beer.

---John Holmes...

--
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


[PHP] prepare() and execute()

2003-03-24 Thread Charles Kline
hi

Could anyone give me an example of a prepare() and execute() that 
retrieves a simple dataset as an associative array and then prints it 
to the screen? I can only seem to find examples that do an INSERT and I 
am having trouble doing the translation.

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


Re: [PHP] Dynamic Form

2003-03-24 Thread Charles Kline
If the page does not submit between changes, PHP will not be much help, 
that would be JavaScript's job. You could use PHP to prepare the arrays 
that JavaScript will use to accomplish this.

- Charles

On Monday, March 24, 2003, at 11:32 AM, Keven Jones wrote:

Hi,

Can someone tell me if I can use php to accomplish
the following:
I would like to create a form that can:

A. Total the sum of a certain number of numerical
fields, Before the user clicks submit
B. Automatically fill in sections of a form
based on selections made by the user. As an example,
if my user selects option A, then a certain numerical
code is filled into a given section of the form.
We are just trying to make the forms user friendly.

Can I do this in php or will it require javascript as well?

Thanks

_
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus

--
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


[PHP] Parsing results from mySQL query

2003-03-22 Thread Charles Kline
Hi everyone,

I have ALMOST gotten this working (mySQL part works).

I have gotten the advice that this is easier to do in PHP then to try 
and make this query work in mySQL. Here is the query and a sampling of 
the current results (from phpMyAdmin)

SELECT p.fname, p.lname,
   w.web_link,
   a.dra_id,
   dra.area,
   t.title
FROM tbl_personnel p
LEFT JOIN tbl_personnel_weblinks w ON p.id = w.person_id
LEFT  JOIN tbl_personnel_dras a ON p.id = a.person_id
LEFT  JOIN tbl_dra dra ON a.dra_id = dra.id
LEFT  JOIN tbl_personnel_titles t ON p.id = t.person_id;
Because some of these people have multiple records in 
tbl_personnel_dras AND in tbl_personnel_titles - I get many repeats of 
each person (one for every combo). I was told this would be really 
messy to deal with in SQL (though I am open) - but I have no idea where 
to start in PHP. I would like to display the data to the web like:

fname lname
title(s) - (this would be the list of titles for this person)
Areas: area, area, area   (this would be the list of areas in one place 
as opposed to making the record repeat)

Thank you for any help.

The above query returns something like this (the first set are the 
column names):

fname
lname
web_link
dra_id
area
title
Jeffrey
Whittle
NULL
NULL
NULL
Investigator
Jeffrey
Whittle
NULL
NULL
NULL
Staff Physician
Adam
Gordon
NULL
5
Mental Illness
Staff Physician
Adam
Gordon
NULL
5
Mental Illness
Assistant Professor of Medicine
Adam
Gordon
NULL
5
Mental Illness
Investigator, VISN4 Mental Illness Research, Educa...
Adam
Gordon
NULL
5
Mental Illness
Investigator, Center for Research on Health Care
Adam
Gordon
NULL
5
Mental Illness
Investigator
Adam
Gordon
NULL
8
Special (Underserved, High Risk) Populations
Staff Physician
Adam
Gordon
NULL
8
Special (Underserved, High Risk) Populations
Assistant Professor of Medicine
Adam
Gordon
NULL
8
Special (Underserved, High Risk) Populations
Investigator, VISN4 Mental Illness Research, Educa...
Adam
Gordon
NULL
8
Special (Underserved, High Risk) Populations
Investigator, Center for Research on Health Care
Adam
Gordon
NULL
8
Special (Underserved, High Risk) Populations
Investigator
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] php, mysql, and method question

2003-03-20 Thread Charles Kline
hi all,

i have a question about a good method of handling this challenge.

i have a table that contains articles. i have another table which 
contains  the order 1 - 9 that i would like to display them in.

this part is done, and is not a problem. here is where I am not sure 
how to proceed.

1. tbl_display_order - can only have 9 records in it (or do i just 
ignore anything beyond 9?)
2. when a new article is added to tbl_display_order - it needs to get 
the field that contains it's order set to 1 so it shows up first when I 
display the articles, and all the other articles need to have their 
order number incremented.

Maybe there is a better way to do this? Just not sure. Maybe not with a 
database at all?

Thanks for suggestions.
Charles 

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


Re: [PHP] To use PEAR::DB or the PHP database functions

2003-03-20 Thread Charles Kline
Pear is really nice. I am very happy with it.

- Charles

On Thursday, March 20, 2003, at 02:56 PM, Merritt, Dave wrote:

All,

I've always used MySQL databases and the MySQL functions in PHP for my 
code
in the past.  However, I'm now working on a project that I want the 
project
to be able to be database independent so that the user of the project 
can
use whatever database he/she wishes.  I'm looking primarily at 
providing
support for MySQL, PostgreSQL, Oracle,  SQL Server databases.  What's 
the
general consensus on how to handle this?  Do I need to look at using
PEAR::DB so that the type of database is hidden from my code or 
would I
look at writing different include files for each database type and 
each of
the include files use the relevant PHP functions?  Or some other 
totally
different way?

Thanks

Dave Merritt
[EMAIL PROTECTED]
--
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


Re: [PHP] Validation of Numeric string sent in a form

2003-03-20 Thread Charles Kline
is_numeric(yoursting);

this returns true if string is a number



On Thursday, March 20, 2003, at 08:32 PM, Orlando Pozo wrote:

Hello all, I am Orlando Pozo

How could I verify if a variable is a Numeric string? , I need help 
in this; for example when I submit a form, all texts fields are sent 
in strings, if you need to verify that the string is all numeric, How 
could I verify?, thanks for your help.



-
Do You Yahoo!?
Todo lo que quieres saber de Estados Unidos, América Latina y el resto 
del Mundo.
Visíta Yahoo! Noticias.


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


[PHP] Anybody have any thoughts on Smarty?

2003-03-19 Thread Charles Kline
Was reading this and it sounds really cool. I do work as a consultant 
to designers and thought this may be a good way to improve work flow? I 
have read mixed thoughts on this, but was wondering what this list 
thought? Anyone using it? Real world?

http://www.zend.com/zend/tut/tutorial-cezar.php

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


[PHP] date question

2003-03-19 Thread Charles Kline
Hi all,

I have a form where users will be adding publication dates for uploaded 
files. I want to store the date in mySQL as date('U') format. If the 
date is entered as mm/dd/ - will the date function know this or is 
there some way of 'telling' php how the date to be converted is 
formatted, if you all get what I am saying...

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


[PHP] strstr() question

2003-03-18 Thread Charles Kline
What is the expected return when using strtr() to compare a string to 
an empty string?

example:

$myval = strstr('bob', '');

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


[PHP] Does PHP run better under any specific unix os?

2003-03-18 Thread Charles Kline
Just wondering. I am trying to decide whether to build a FreeBSD server 
or other... open to suggestions

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


[PHP] stripping slashes before insert behaving badly

2003-03-17 Thread Charles Kline
Hi all,

I am inserting data from a form into a mySQL database. I am using 
addslashes to escape things like ' in the data input (this is actually 
being done in PEAR (HTML_QuickForm).

The weird thing is that the data gets written into the table like:   
what\'s your problem?

WITH the slash. I am not sure what to modify to fix this so the literal 
slash is not written.

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


Re: [PHP] re: variables with

2003-03-17 Thread Charles Kline
php has a function stripslashes() you could try using.

- charles

On Monday, March 17, 2003, at 10:11 AM, Ian A. Gray wrote:

Using the \ or using single quotes instead of double
is great.  However I am now finding a problem if
someone inputs either single or double quotes on a
form which uses php.
The user inputs for example:
I\ve performed many roles including Figaro,
Dandini and 'Wotan'
becomes:
I\'ve performed many roles including \Figaro\,
\Dandini\ and \'Wotan\'
Is there a simple way of getting rid of the annoying
backslash(\) from a the contents of a variable?
Many thanks,

Ian Gray

=

-
Ian A. Gray
Manchester, UK
Telephone: +44 (0) 161 224 1635 - Fax: +44 (0) 870 135 0061 - Mobile: 
+44 (0) 7900 996 328
US Fax no.:  707-885-3582
E-mail: [EMAIL PROTECTED] - Websites: www.baritone.uk.com 
(performance)  www.vocalstudio.co.uk (Tuition)
-

__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
--
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


Re: [PHP] stripping slashes before insert behaving badly

2003-03-17 Thread Charles Kline
John,

You are right, something was adding the additional slash. I removed the 
addslashes() and it fixed the problem. Something I am doing must 
already be handling that... will step through the code AGAIN and see if 
I can find it.

- Charles

On Monday, March 17, 2003, at 12:19 PM, John W. Holmes wrote:

I am inserting data from a form into a mySQL database. I am using
addslashes to escape things like ' in the data input (this is actually
being done in PEAR (HTML_QuickForm).
The weird thing is that the data gets written into the table like:
what\'s your problem?
WITH the slash. I am not sure what to modify to fix this so the
literal
slash is not written.
You're running addslashes() twice, somehow. Magic_quotes_gpc is 
probably
on and you're escaping the data again. I would think PEAR would account
for that, but I guess not.

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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


[PHP] What is the difference: include()

2003-03-17 Thread Charles Kline
What is the difference as in... why one or the other?

include('somefile.php');

include(somefile.php);

Just wondering...

- ck

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


Re: [PHP] What is the difference: include()

2003-03-17 Thread Charles Kline
perfect. thanks for the explanation.

cheers,
charles
On Monday, March 17, 2003, at 02:01 PM, Pete James wrote:

Only that you can embed vars in the second one.

if $foo='bar';

include('somefile_{$foo}');
will include the file 'somefile{$foo}', where
include(somefile_{$foo});
will include the file 'somefile_bar'
HTH.

Charles Kline wrote:
What is the difference as in... why one or the other?
include('somefile.php');
include(somefile.php);
Just wondering...
- ck




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


Re: [PHP] building a large-scale application using oop

2003-03-16 Thread Charles Kline
Not sure how to answer your question as I am real new to PHP, but you 
may want to look at PEAR if you have not done so. I know there are 
libraries that folks have been talking about recently that handle just 
these sorts of things. If you don't use them - you may find your 
answers by looking at the sources.

- Charles

On Sunday, March 16, 2003, at 12:57 PM, [EMAIL PROTECTED] wrote:

Hi,

I am currently working on transforming a rather large software package 
to
oop. I do have a few years of experience with php, but just started to 
use oop.
One of the first question that arose was how to handle configuration 
vars.
These should ideally be stored in a file:

?php

$db_user = user;
$db_password =secret;
etc.

?

Now, I have to access these vars from a class.

class database {

var $db_user;
var $db_password;
function connect()
 {
}

}

What is the best way to access these variables? I want to avoid global 
vars.
I also don't like to set the vars using $object-db_user = $db_user; 
every
time I use it.

Also, is there any large open-source php - application which could 
serve as
an example of best practice?

best regards,

Raul

--
+++ GMX - Mail, Messaging  more  http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!
--
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


Re: [PHP] File System

2003-03-16 Thread Charles Kline
On Monday, March 17, 2003, at 12:58 AM, Philip J. Newman wrote:

How do i delete a file  ... ?

kill?? dele *srugs*

--
Philip J. Newman.
Head Developer
[EMAIL PROTECTED]
+64 (9) 576 9491
+64 021-048-3999
--
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


Re: [PHP] File System

2003-03-16 Thread Charles Kline
$result = unlink(file.txt) or die(Operation failed!');

On Monday, March 17, 2003, at 12:58 AM, Philip J. Newman wrote:

How do i delete a file  ... ?

kill?? dele *srugs*

--
Philip J. Newman.
Head Developer
[EMAIL PROTECTED]
+64 (9) 576 9491
+64 021-048-3999
--
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


[PHP] How to convert an array to variables?

2003-03-15 Thread Charles Kline
Hi all,

I have an array that gives me this when I do:

print_r($my_array);

Array
(
[0] = Array
(
[dra_id] = 5
)
[1] = Array
(
[dra_id] = 8
)
[2] = Array
(
[dra_id] = 9
)
)

using a foreach() I want to create a variable with a unique incremental 
name for each of the values.

for example:

$dra_1 = 5;
$dra_2 = 8;
$dra_3 = 9;
How would I do this? A variable that has a variable name based on a 
counter in the loop? Not sure the syntax for that.

Thanks
Charles




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


[PHP] PHP User Groups

2003-03-15 Thread Charles Kline
Hi all,

Is or has anyone here been part of or started a PHP user group? I am 
thinking it would be a great thing to get started in my area (maybe one 
already exists?) and I was looking for suggestions on how to go about 
it and things to know before getting started, etc.
BTW. I live in Southern New Jersey (USA)

Please feel free to contact me off list.

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


Re: [PHP] How to convert an array to variables?

2003-03-15 Thread Charles Kline
Tom,

This seems like what I need exactly, but I am having a bit of trouble 
getting it to work.

Here is how I have worked around this, but I know there is a 'real' way 
to do this. Any thoughts? I had to set the variables, or should I just 
use the variables as ${dra_0} etc.?

// get the values for the default dra from array
while(list($key,$val) = each($r_p_dras)){
$n = dra_$key;
echo $n;
$$n = $val['dra_id'];
}
$dra_a = ${dra_0};
$dra_b = ${dra_1};
$dra_c = ${dra_2};
$dra_d = ${dra_3};
$dra_e = ${dra_4};
On Saturday, March 15, 2003, at 02:08 PM, Tom Rogers wrote:

Hi,

Sunday, March 16, 2003, 4:52:10 AM, you wrote:
CK Hi all,
CK I have an array that gives me this when I do:

CK print_r($my_array);

CK Array
CK (
CK  [0] = Array
CK  (
CK  [dra_id] = 5
CK  )
CK  [1] = Array
CK  (
CK  [dra_id] = 8
CK  )
CK  [2] = Array
CK  (
CK  [dra_id] = 9
CK  )
CK )

CK using a foreach() I want to create a variable with a unique 
incremental
CK name for each of the values.

CK for example:

CK $dra_1 = 5;
CK $dra_2 = 8;
CK $dra_3 = 9;
CK How would I do this? A variable that has a variable name based on a
CK counter in the loop? Not sure the syntax for that.
CK Thanks
CK Charles
something like this...

while(list($key,$val) = each($my_array)){
$n = 'dra_'.$key+1;
$$n = $val['dra_id'];
}




--
regards,
Tom


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


Re: [PHP] File upload Stuff ... well kinda.

2003-03-15 Thread Charles Kline
Check the permissions on the directory you are trying to upload your 
files. The host I am using required me to either chmod the upload 
directory to 777 (not what I wanted to do) or run PHP with cgi-wrap 
enabled - this allowed my PHP application to run as the user and 
therefore had permission to write to a directory. Check with the host 
on this.

- Charles

On Saturday, March 15, 2003, at 09:53 PM, Philip J. Newman wrote:

RIghto then.  Just make a nice website, on my windows box and 
everything and
when i moved it to the live server, the things that didn't work where 
file
uploads.  What (if any) settings do i have to use for a Linux dir ..

to allow access for the file to be uploaded?

--
Philip J. Newman.
Head Developer
[EMAIL PROTECTED]
+64 (9) 576 9491
+64 021-048-3999
--
Friends are like stars
You can't allways see them,
but they are always there.
--
Websites:
PhilipNZ.com - Design.
http://www.philipnz.com/
[EMAIL PROTECTED]
Philip's Domain // Internet Project.
http://www.philipsdomain.com/
[EMAIL PROTECTED]
Vital Kiwi / NEWMAN.NET.NZ.
http://www.newman.net.nz/
[EMAIL PROTECTED]


--
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


[PHP] Newbie MySQL INSERT Q

2003-03-14 Thread Charles Kline
Can I have a single SQL string do INSERTS into multiple tables?

Like:

sql=INSERT INTO tbl_1 (id,
email_address_1)
VALUES ($v_personid,
'$v_email');
INSERT INTO tbl_2 (person_id,
interest_id)
VALUES ($v_personid,
$v_int1);;
Or do I need to break them up and use two of these?

$result = $db-query($sql)

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


[PHP] PHP with CGI WRAP

2003-03-13 Thread Charles Kline
Can anyone point me to a good resource on how to run PHP with CGI Wrap? 
I am hosting a site that is under development at Pair networks and they 
have their own cgi-wrapper and I need to move this site to another 
server that probably does not have their own flavor of this. Any help 
would be appreciated.

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


[PHP] Problem with string comparison

2003-03-13 Thread Charles Kline
I am trying to get this sql query to work and am getting the error 
Insufficient data supplied. Can anyone help with this?

$sql =  SELECT id, concat(fname, ' ', lname, ' ', degree1) name
  FROM tbl_personnel WHERE name LIKE \'%;
$sql .= $attributes['nametofind'];
$sql .= %\' ORDER BY lname ASC;
What I am trying to do is allow the user to find a personnel record 
that contains the name to find.

Thanks,
Charles 

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


Re: [PHP] Problem with string comparison

2003-03-13 Thread Charles Kline
On Thursday, March 13, 2003, at 05:08 PM, Ernest E Vogelsinger wrote:

- if your query is exactly as you sent it here you're missing a comma 
after
the closing bracket of concat(), just before name
name is supposed to be an alias for the concatenated values of 
fname,lname,mname.

Let me try to say what I am trying to do. I have a table of people and 
have the names saved in fields: fname, lname, mname. I want to have a 
search field where the user can find a persons record by typing in all 
or part of their name. What would this kind of query look like?

Thanks
Charles


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


[PHP] PHP and MySQL Full Text Search Problem

2003-03-13 Thread Charles Kline
Hi all,

My first try at MySQL Full Text Search and it is not behaving ;)

Here is what I have for my query string:

$sql = SELECT id, concat(fname, ' ', lname, ' ', degree1) as name.
FROM tbl_personnel WHERE MATCH (fname,lname) AGAINST (' .
   $attributes['searchstring'] . ');
This works pretty good. The only problem is it only works if there is 
an exact match for either the first name (fname) or last name. For 
example. In tbl_personnel there are 5 people with the first name 
Christine.

If I pass Chris to this query in $attributes['searchstring'] I get 0 
results. If I pass Christine I get all 5.

What do I need to modify to make this work?

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


[PHP] file_exists() question

2003-03-08 Thread Charles Kline
Can anyone tell me why this code does not return true when the file in 
the directory cherpdocs/ with the file (which I see as being there) 
does exist?

if(file_exists('cherpdocs/$annrow[id].doc')){
echo br /a href=\cherpdocs/$annrow[id].doc\Funding 
details paper/a;
 }

This is a path relative to the file calling it, should it be otherwise?

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


[PHP] MySQL Alias and PHP

2003-03-07 Thread Charles Kline
Hi all,

I have this query:

SELECT a.area_name, b.area_name FROM tbl_1 x, tbl_2 a, tbl_2 b
WHERE x.area_1 = a.id
AND x.area_2 = b.id
I am using PEAR DB to get my results as an ASSOC ARRAY. How do I echo 
the values for a.id and b.id?

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


Re: [PHP] MySQL Alias and PHP

2003-03-07 Thread Charles Kline
Thanks for the help. Almost there. Here is what I have:

SELECT x.id, x.headline, x.description, a.area area_a, b.area area_b
FROM tbl_funding x, tbl_dra a, tbl_dra b
GROUP  BY x.id LIMIT 0 , 30
The problem is that $array[area_a] and $array[area_b] display the same 
info.





On Friday, March 7, 2003, at 11:09 AM, Rich Gray wrote:

Hi all,

I have this query:

SELECT a.area_name, b.area_name FROM tbl_1 x, tbl_2 a, tbl_2 b
WHERE x.area_1 = a.id
AND x.area_2 = b.id
I am using PEAR DB to get my results as an ASSOC ARRAY. How do I echo
the values for a.id and b.id?
Thnks
Charles
I presume you mean area_name...

Try this - SELECT a.area_name as area_a, b.area_name as area_b FROM 
tbl_1
x, tbl_2 a, tbl_2 b
Then you can refer to the columns as $array['area_a'] and 
$array['area_b']

HTH
Rich


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


Re: [PHP] MySQL Alias and PHP

2003-03-07 Thread Charles Kline
Thanks for all the suggestions, I have tried all and more and still 
can't get this quite right. If there is a better forum for these 
question, please point me to it and I will take this somewhat off topic 
thread elsewhere.

My table structure is like so:

tbl_1

idarea_1area_2
1  2   3
2  1   2
3  5   0
tbl_2

id area_name
1  funding
2  research
3  new
4  ongoing
5  other
So, I need to display all the records in tbl_1 and show the values for 
the fields area_1 and area_2 as their area_name field from tbl_2. I 
must display each record from tbl_1 only once. I know I am close, but I 
just can't get this to work. The closest I have gotten is this:

SELECT DISTINCT  a.area_name area_a, b.area_name area_b FROM tbl_1 x, 
tbl_2 a, tbl_2 b
WHERE x.area_1 = a.id
OR x.area_2 = b.id GROUP BY x.id

But this ALWAYS returns the area_name (funding) in the value of area_b 
(have no idea why)

Thanks for any help. It is appreciated.

- Charles

On Friday, March 7, 2003, at 01:42 PM, Jim Lucas wrote:

Then the information in the DB is the same.

Jim
- Original Message -
From: Charles Kline [EMAIL PROTECTED]
To: Rich Gray [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, March 07, 2003 10:03 AM
Subject: Re: [PHP] MySQL Alias and PHP
Thanks for the help. Almost there. Here is what I have:

SELECT x.id, x.headline, x.description, a.area area_a, b.area area_b
FROM tbl_funding x, tbl_dra a, tbl_dra b
GROUP  BY x.id LIMIT 0 , 30
The problem is that $array[area_a] and $array[area_b] display the same
info.




On Friday, March 7, 2003, at 11:09 AM, Rich Gray wrote:

Hi all,

I have this query:

SELECT a.area_name, b.area_name FROM tbl_1 x, tbl_2 a, tbl_2 b
WHERE x.area_1 = a.id
AND x.area_2 = b.id
I am using PEAR DB to get my results as an ASSOC ARRAY. How do I echo
the values for a.id and b.id?
Thnks
Charles
I presume you mean area_name...

Try this - SELECT a.area_name as area_a, b.area_name as area_b FROM
tbl_1
x, tbl_2 a, tbl_2 b
Then you can refer to the columns as $array['area_a'] and
$array['area_b']
HTH
Rich


--
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


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


Re: [PHP] MySQL Alias and PHP

2003-03-07 Thread Charles Kline
Wow. That is ALMOST it. The only thing is it does not return the record 
with a 0 in tbl_1.area_2 - can you think of a workaround?

Thanks for the help,
Charles
On Friday, March 7, 2003, at 06:39 PM, Barajas, Arturo wrote:

Let's see:

SELECT
tbl_1.area_1,
areas1.area_name,
tbl_1.area_2,
areas2.area_name
FROM
tbl_1
INNER JOIN tbl_2 areas1 ON tbl_1.area_1 = areas1.id
INNER JOIN tbl_2 areas2 ON tbl_1.area_2 = areas2.id
Maybe if you tinker a little on the sentence. I don't have a place to 
test it right now.
--
Un gran saludo/Big regards...
   Arturo Barajas, IT/Systems PPG MX (SJDR)
   (427) 271-9918, x448

-Original Message-
From: Charles Kline [mailto:[EMAIL PROTECTED]
Sent: Viernes, 07 de Marzo de 2003 04:09 p.m.
To: Jim Lucas
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] MySQL Alias and PHP
Thanks for all the suggestions, I have tried all and more and still
can't get this quite right. If there is a better forum for these
question, please point me to it and I will take this somewhat
off topic
thread elsewhere.
My table structure is like so:

tbl_1

idarea_1area_2
1  2   3
2  1   2
3  5   0
tbl_2

id area_name
1  funding
2  research
3  new
4  ongoing
5  other
So, I need to display all the records in tbl_1 and show the
values for
the fields area_1 and area_2 as their area_name field from tbl_2. I
must display each record from tbl_1 only once. I know I am
close, but I
just can't get this to work. The closest I have gotten is this:
SELECT DISTINCT  a.area_name area_a, b.area_name area_b FROM tbl_1 x,
tbl_2 a, tbl_2 b
WHERE x.area_1 = a.id
OR x.area_2 = b.id GROUP BY x.id
But this ALWAYS returns the area_name (funding) in the value
of area_b
(have no idea why)
Thanks for any help. It is appreciated.

- Charles

On Friday, March 7, 2003, at 01:42 PM, Jim Lucas wrote:

Then the information in the DB is the same.

Jim
- Original Message -
From: Charles Kline [EMAIL PROTECTED]
To: Rich Gray [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, March 07, 2003 10:03 AM
Subject: Re: [PHP] MySQL Alias and PHP
Thanks for the help. Almost there. Here is what I have:

SELECT x.id, x.headline, x.description, a.area area_a, b.area area_b
FROM tbl_funding x, tbl_dra a, tbl_dra b
GROUP  BY x.id LIMIT 0 , 30
The problem is that $array[area_a] and $array[area_b]
display the same
info.





On Friday, March 7, 2003, at 11:09 AM, Rich Gray wrote:

Hi all,

I have this query:

SELECT a.area_name, b.area_name FROM tbl_1 x, tbl_2 a, tbl_2 b
WHERE x.area_1 = a.id
AND x.area_2 = b.id
I am using PEAR DB to get my results as an ASSOC ARRAY.
How do I echo
the values for a.id and b.id?

Thnks
Charles
I presume you mean area_name...

Try this - SELECT a.area_name as area_a, b.area_name as
area_b FROM
tbl_1
x, tbl_2 a, tbl_2 b
Then you can refer to the columns as $array['area_a'] and
$array['area_b']
HTH
Rich


--
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


--
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


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


[PHP] File upload and permissions

2003-03-06 Thread Charles Kline
I have a form which uploads a file to my server. The files that are 
uploaded will be .doc files and will need to be able to be downloaded 
from a web page.

My script works locally - I have tested it well files upload etc., but 
I am moving it to a commercial web server and am not sure what 
permissions should be set like for this directory. I have tried my 
script and gotten the files to upload but when the script tries to move 
them to the directory where I want to keep them I get a permission 
denied error. I have played with it - changing permissions and the only 
one that works is chmod 777 - not sure if this is good or not - pretty 
new to unix administration stuff.

What do you all suggest?

Thanks,
Charles


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


[PHP] inserting date() into MySQL

2003-03-04 Thread Charles Kline
If I am going to use date('U') to insert an epoch timestamp into a 
mysql table, what is the appropriate field type to use?

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


[PHP] date range assistance needed

2003-03-03 Thread charles kline
Here is my current query:

$qAnnouncement =
'SELECT id,headline
 FROM tbl_funding
WHERE 1
AND ((UNIX_TIMESTAMP (datestamp) = ' . 
strtotime($attributes[startdate]) . ') AND (UNIX_TIMESTAMP (datestamp) 
= ' . strtotime($attributes[startdate]) . ')) LIMIT 0, 30';

Where datestamp is set in MySQL with a timestamp(14) and 
$attributes[startdate] and $attributes[enddate] are in the format 
mm/dd/

My query does not return any results. I know there must be something 
wrong, can anyone point it out?

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


[PHP] dealing with dates

2003-03-03 Thread Charles Kline
Hi all,

I posted earlier with some date questions, but realized I could 
probably do better with my question presented as such.

I need to save the time date and time of posting for the records in a 
table.
I then need to be able to search via a startdate and enddate text field 
where the user will be entering the date ranges as mm/dd/.

What is the best way to handle adding the date to the MySQL record, and 
also how to search for that date based on a range in the above stated 
format?

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