Re: [PHP] Stumped - MDB2 & pgsql

2010-07-15 Thread Michael A. Peters

Michael A. Peters wrote:

Michael A. Peters wrote:
I need to switch from MySQL (where everything is peachy) to Postgresql 
- reason I need to switch is I need to use PostGIS and I don't see a 
need to run two databases.


I got Postgresql installed (stock CentOS / RHEL 5) and installed the 
postgresql php module and mdb2 driver. Restarted the web server.


Did a MySQL dump, ran it through a perl script, and managed to get it 
load into Postgresql without any apparent hickups. I can connect to 
postgresql and issue queries and expected results are in fact returned.


Made a user called webuser (what, you expect the real name to be 
disclosed here ??) in postgresql and gave it a password and access to 
the database. Updated the data/pg_hba.conf to add the following line:


localmydbname webuser   127.0.0.1 password

restarted the postgresql server.

I *thought* that all I would then have to do is change my mdb2 dsn to 
reflect the new driver to use and then find parts of my code that are 
not standard enough SQL - but when I try to use anything, I get -


Fatal error: Call to undefined method MDB2_Error::execute() in 
/path/to/blah  on line 63


I'm missing something here.

Here's my dsn -

$dsn = array(
   'phptype'  => 'pgsql',
   'username' => 'webuser',
   'password' => 'secret',
   'hostspec' => 'localhost',
   'database' => 'mydbname');

What am I doing wrong?
I get the same error no matter what I set 
username/password/hostspec/database to - so I think it is a basic 
connection error.


Yes, I put some error catching in -

MDB2 Error: connect failed, _doConnect: [Error message: unable to 
establish a connection]


So it looks like pg_hba.conf file either isn't allowing it or something 
else is blocking it.


Possibly solved.
This line works -

hostmydbname webuser   127.0.0.1/32 password

provided I removed the previous host line that specified authentication 
by ident for all users connection via tcp from localhost.


Still getting errors, but now its a db grant issue and not a connection 
issue, so i think I'm good to go.


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



Re: [PHP] Stumped - MDB2 & pgsql

2010-07-15 Thread Michael A. Peters

Michael A. Peters wrote:
I need to switch from MySQL (where everything is peachy) to Postgresql - 
reason I need to switch is I need to use PostGIS and I don't see a need 
to run two databases.


I got Postgresql installed (stock CentOS / RHEL 5) and installed the 
postgresql php module and mdb2 driver. Restarted the web server.


Did a MySQL dump, ran it through a perl script, and managed to get it 
load into Postgresql without any apparent hickups. I can connect to 
postgresql and issue queries and expected results are in fact returned.


Made a user called webuser (what, you expect the real name to be 
disclosed here ??) in postgresql and gave it a password and access to 
the database. Updated the data/pg_hba.conf to add the following line:


localmydbname webuser   127.0.0.1 password

restarted the postgresql server.

I *thought* that all I would then have to do is change my mdb2 dsn to 
reflect the new driver to use and then find parts of my code that are 
not standard enough SQL - but when I try to use anything, I get -


Fatal error: Call to undefined method MDB2_Error::execute() in 
/path/to/blah  on line 63


I'm missing something here.

Here's my dsn -

$dsn = array(
   'phptype'  => 'pgsql',
   'username' => 'webuser',
   'password' => 'secret',
   'hostspec' => 'localhost',
   'database' => 'mydbname');

What am I doing wrong?
I get the same error no matter what I set 
username/password/hostspec/database to - so I think it is a basic 
connection error.


Yes, I put some error catching in -

MDB2 Error: connect failed, _doConnect: [Error message: unable to 
establish a connection]


So it looks like pg_hba.conf file either isn't allowing it or something 
else is blocking it.


*sigh* - guess back to trying to find document on setting up 
authentication for an account for a pgsql web app user because the docs 
I did find don't seem to be accurate.


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



[PHP] Stumped - MDB2 & pgsql

2010-07-15 Thread Michael A. Peters
I need to switch from MySQL (where everything is peachy) to Postgresql - 
reason I need to switch is I need to use PostGIS and I don't see a need 
to run two databases.


I got Postgresql installed (stock CentOS / RHEL 5) and installed the 
postgresql php module and mdb2 driver. Restarted the web server.


Did a MySQL dump, ran it through a perl script, and managed to get it 
load into Postgresql without any apparent hickups. I can connect to 
postgresql and issue queries and expected results are in fact returned.


Made a user called webuser (what, you expect the real name to be 
disclosed here ??) in postgresql and gave it a password and access to 
the database. Updated the data/pg_hba.conf to add the following line:


localmydbname webuser   127.0.0.1 password

restarted the postgresql server.

I *thought* that all I would then have to do is change my mdb2 dsn to 
reflect the new driver to use and then find parts of my code that are 
not standard enough SQL - but when I try to use anything, I get -


Fatal error: Call to undefined method MDB2_Error::execute() in 
/path/to/blah  on line 63


I'm missing something here.

Here's my dsn -

$dsn = array(
   'phptype'  => 'pgsql',
   'username' => 'webuser',
   'password' => 'secret',
   'hostspec' => 'localhost',
   'database' => 'mydbname');

What am I doing wrong?
I get the same error no matter what I set 
username/password/hostspec/database to - so I think it is a basic 
connection error.


I'm hoping to be able to get the switch to postgresql finished soon so 
that I can start playing with using the PostGIS extension.


I'm running php 5.2.12 (my own build, based on Fedora src.rpm) w/ pear 
1.8.1:


pear list
Installed packages, channel pear.php.net:
=
Package   Version State
Archive_Tar   1.3.3   stable
Console_Getopt1.2.3   stable
Date  1.4.7   stable
MDB2  2.4.1   stable
MDB2_Driver_mysql 1.4.1   stable
MDB2_Driver_pgsql 1.4.1   stable
PEAR  1.8.1   stable
Structures_Graph  1.0.2   stable
Text_Highlighter  0.7.1   beta
XML_Parser1.3.2   stable
XML_RPC   1.5.1   stable
XML_Util  1.2.1   stable

Thanks for suggestions.

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



Re: [PHP] Stumped I Tell You!

2008-07-25 Thread Daniel Brown
On Fri, Jul 25, 2008 at 3:41 PM, Jay Blanchard <[EMAIL PROTECTED]> wrote:
>
> I see you get whacked around the head here every so often...and if not
> here I am sure that your SO handles it as needed.

Yeah, but she's in Virginia Beach for the week, so there's a
slight chance the bruising will fade.

-- 

Better prices on dedicated servers:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

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



RE: [PHP] Stumped I Tell You!

2008-07-25 Thread Jay Blanchard
[snip]By the way, I didn't mean to insinuate that your use of the
if()
condition was incorrect[/snip]

No worries.

[snip] Someone needs to whack me upside the head every so often.  In my
case, that might be a patentable invention.[/snip]

I see you get whacked around the head here every so often...and if not
here I am sure that your SO handles it as needed.

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



Re: [PHP] Stumped I Tell You!

2008-07-25 Thread David Giragosian
On 7/25/08, Daniel Brown <[EMAIL PROTECTED]> wrote:
>
> On Fri, Jul 25, 2008 at 3:07 PM, Jay Blanchard <[EMAIL PROTECTED]>
> wrote:
> >
> > *slaps forehead soundly* I found that there was a missing greater than
> > sign in a greater than or equal to requirement in an earlier query.
>
>The most minuscule errors cause the greatest harm.
>
>By the way, I didn't mean to insinuate that your use of the if()
> condition was incorrect, though I admit that, re-reading it, it
> absolutely sounds that way.  I just meant that it was my preferred
> method.  I also realized that I jumped the gun on the "Send" button
> before sending the contents of the second message I sent.  Someone
> needs to whack me upside the head every so often.  In my case, that
> might be a patentable invention.



Already patented. It's called "The Spouse".

--David.


Re: [PHP] Stumped I Tell You!

2008-07-25 Thread Daniel Brown
On Fri, Jul 25, 2008 at 3:07 PM, Jay Blanchard <[EMAIL PROTECTED]> wrote:
>
> *slaps forehead soundly* I found that there was a missing greater than
> sign in a greater than or equal to requirement in an earlier query.

The most minuscule errors cause the greatest harm.

By the way, I didn't mean to insinuate that your use of the if()
condition was incorrect, though I admit that, re-reading it, it
absolutely sounds that way.  I just meant that it was my preferred
method.  I also realized that I jumped the gun on the "Send" button
before sending the contents of the second message I sent.  Someone
needs to whack me upside the head every so often.  In my case, that
might be a patentable invention.

-- 

Better prices on dedicated servers:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

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



RE: [PHP] Stumped I Tell You!

2008-07-25 Thread Jay Blanchard
[snip]
I'm sure you've already tried this, but did you copy the SQL query
echo'd out and try it directly with MySQL to make sure there are rows
returned?
[/snip]

Yes.


*slaps forehead soundly* I found that there was a missing greater than
sign in a greater than or equal to requirement in an earlier query.

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



Re: [PHP] Stumped I Tell You!

2008-07-25 Thread Daniel Brown
On Fri, Jul 25, 2008 at 2:36 PM, Jay Blanchard <[EMAIL PROTECTED]> wrote:
>
> I have several other queries running in this example and they all use
> the same run/error check routine with no issues.

I'm sure you've already tried this, but did you copy the SQL query
echo'd out and try it directly with MySQL to make sure there are rows
returned?

-- 

Better prices on dedicated servers:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

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



RE: [PHP] Stumped I Tell You!

2008-07-25 Thread Jay Blanchard
[snip]
 [snip!]
>
> $endBal = mysql_fetch_array($dbEnd);
> echo mysql_num_rows($dbEnd);
> print_r($endBal);
>
> Nothing gets returned from those last statements. Am I missing
something
> completely?

Right here



You're merging assignment.  Maybe you meant this:


[/snip]

I have several other queries running in this example and they all use
the same run/error check routine with no issues. This has always worked
in the past. It is like saying if(!$theFile = fopen('myfile.txt', 'a'))

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



Re: [PHP] Stumped I Tell You!

2008-07-25 Thread Daniel Brown
On Fri, Jul 25, 2008 at 1:55 PM, Jay Blanchard <[EMAIL PROTECTED]> wrote:
[snip!]
>
> $endBal = mysql_fetch_array($dbEnd);
> echo mysql_num_rows($dbEnd);
> print_r($endBal);
>
> Nothing gets returned from those last statements. Am I missing something
> completely?

Right here



You're merging assignment.  Maybe you meant this:



Or you could do it like I do:



-- 

Better prices on dedicated servers:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

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



[PHP] Stumped I Tell You!

2008-07-25 Thread Jay Blanchard
$getEnd = "select a.ACCOUNTID as CONTRACT, a.BALANCE/1 as BALANCE,
b.STATUS, b.IMSI_ID as MDN, b.IMEI_ID as ESN, ";
$getEnd .= "b.EQUIP_ID as MIN, b.MKT, b.MARKET_NAME ";
$getEnd .= "FROM work.account_".$startDate." a ";
$getEnd .= "JOIN work.customer_".$startDate." b ";
$getEnd .= "ON ( b.CONTRACT_ID = a.ACCOUNTID AND b.RUNDATE =
date_sub(a.BC_ACCOUNT_ARC_DATE, interval 1 day)) ";
$getEnd .= "WHERE a.BC_ACCOUNT_ARC_DATE =
str_to_date('".$endDate."','%Y%m%d') ";
$getEnd .= "AND a.ACCOUNTID = '".$acct['CONTRACT']."' ";
$getEnd .= "AND a.status = 1 ";
$getEnd .= "AND a.balance > 0 ";
if(!$dbEnd = (mysql_query($getEnd, $dbc))){
echo mysql_error() . "\n";
exit();
}
echo $getEnd;

returns

select a.ACCOUNTID as CONTRACT, a.BALANCE/1 as BALANCE, b.STATUS,
b.IMSI_ID as MDN, b.IMEI_ID as ESN, b.EQUIP_ID as MIN, b.MKT,
b.MARKET_NAME FROM work.account_20080601 a JOIN work.customer_20080601 b

ON ( b.CONTRACT_ID = a.ACCOUNTID AND b.RUNDATE =
date_sub(a.BC_ACCOUNT_ARC_DATE, interval 1 day)) 
WHERE a.BC_ACCOUNT_ARC_DATE = str_to_date('20080602','%Y%m%d') 
AND a.ACCOUNTID = '180' 
AND a.status = 1 
AND a.balance > 0

...which works from the command line.

$endBal = mysql_fetch_array($dbEnd);
echo mysql_num_rows($dbEnd);
print_r($endBal);

Nothing gets returned from those last statements. Am I missing something
completely? 

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



[PHP] Stumped! 4.x to 5.1 problem!!

2006-07-21 Thread Mark
I have an extension that seems to create PHP variables correctly, and
var_dump() doesn't seem to have a problem. but upon moving to 5.1.x it
fails.

Anyone have a suggestion?

 
array(2) {
  [0]=>
  object(classfoo)#2 (1) {
["hostname"]=>
string(3) "foo"
  }
  [1]=>
  object(classfoo)#3 (1) {
["hostname"]=>
string(3) "bar"
  }
}
array(2) {
  ["0"]=>
  object(classfoo)#4 (1) {
["hostname"]=>
string(3) "foo"
  }
  ["1"]=>
  object(classfoo)#5 (1) {
["hostname"]=>
string(3) "bar"
  }
}
Object failed


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

Re: [PHP] STUMPED: path/style vars in Windows with IIS

2004-12-13 Thread Ck
Hi Richard.

Thank you for the reply.  I was dragged to IIS kicking and screaming! 
I have been doing php development for almost 6 years, and this will be
my first production-level experience with php through IIS...

Unfortunately it is a hosted environment and there is a legacy
coldfusion application that needs to be maintained.  We could not find
a hosting company that offers php & coldfusion via apache, as well as
meeting some other email-related and SLA requirements.

I changed my Link class to use the ?normal=style vars rather than
/path/style, and thereby am circumventing the issue for the time-being.

Thank you,

Chris

--- Richard Lynch <[EMAIL PROTECTED]> wrote:

> Ck wrote:
> > Hello.
> >
> > I am trying to get path/style variables working in windows with IIS
> on
> > a hosted environment.  What I mean by path/style variables is the
> > following:  Say I have a script "test.php" that can be accessed
> via:
> >
> > http://mydomain/controller.php
> >
> > ...I want to pass variables to it like:
> >
> > http://mydomain/controller.php/article/10
> >
> > ...With IIS, I get a "404 Object Not Found" error when I append
> > anything after "controller.php".  In the past with Apache this has
> > always just simply worked, even as a cgi module.  What do I do to
> get
> > this working with IIS?
> 
> Switch to Apache :-)
> http://apache.org
> 
> Actually, semi-seriously -- If you *can* switch, you'll be able to
> install, configure, and fix this issue in Apache faster than you can
> figure out how to fix this one issue in IIS.  Much less fix all the
> other
> issues you're going to run into in IIS.
> 
> YMMV.
> 
> -- 
> Like Music?
> http://l-i-e.com/artists.htm
> 
> -- 
> 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] STUMPED: path/style vars in Windows with IIS

2004-12-13 Thread Richard Lynch
Ck wrote:
> Hello.
>
> I am trying to get path/style variables working in windows with IIS on
> a hosted environment.  What I mean by path/style variables is the
> following:  Say I have a script "test.php" that can be accessed via:
>
> http://mydomain/controller.php
>
> ...I want to pass variables to it like:
>
> http://mydomain/controller.php/article/10
>
> ...With IIS, I get a "404 Object Not Found" error when I append
> anything after "controller.php".  In the past with Apache this has
> always just simply worked, even as a cgi module.  What do I do to get
> this working with IIS?

Switch to Apache :-)
http://apache.org

Actually, semi-seriously -- If you *can* switch, you'll be able to
install, configure, and fix this issue in Apache faster than you can
figure out how to fix this one issue in IIS.  Much less fix all the other
issues you're going to run into in IIS.

YMMV.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] STUMPED: path/style vars in Windows with IIS

2004-12-13 Thread Ck
Hello.

I am trying to get path/style variables working in windows with IIS on
a hosted environment.  What I mean by path/style variables is the
following:  Say I have a script "test.php" that can be accessed via:

http://mydomain/controller.php

...I want to pass variables to it like:

http://mydomain/controller.php/article/10

...With IIS, I get a "404 Object Not Found" error when I append
anything after "controller.php".  In the past with Apache this has
always just simply worked, even as a cgi module.  What do I do to get
this working with IIS?

Thanks in advance,

Chris

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



[PHP] Stumped on a totally wierd problem

2004-02-28 Thread Brian V Bonini
nevermind I got it.


<< snip >>
I have something really wierd going on with a form that let's a user
add/edit/delete data from a mysql database.

It's like I can not edit any data that was not recently added or if it
was added by another user.

If I log into mysql directly under the same user I'm using form the php
script and run the same query it's fine. But if I run it form the form
it behave like everything is ok but the data is not updated. AND only on
old data or data someone else added. If add some data I can for a while
edit it all I want from the php script but after a while (like the next
day) I can no longer edit it. Goes through all the motions, no error
messages, but no updates in the db. Yest, as I said, at the same time I
can still edit "fresh" data so the queries must be fine AND I can edit
the data directly.

I've never encountered this before so any suggestions It's like the
data is tied to a certain session or something. 

I hope that makes sense.

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



[PHP] Stumped on a totally wierd problem

2004-02-28 Thread Brian V Bonini
I have something really wierd going on with a form that let's a user
add/edit/delete data from a mysql database.

It's like I can not edit any data that was not recently added or if it
was added by another user.

If I log into mysql directly under the same user I'm using form the php
script and run the same query it's fine. But if I run it form the form
it behave like everything is ok but the data is not updated. AND only on
old data or data someone else added. If add some data I can for a while
edit it all I want from the php script but after a while (like the next
day) I can no longer edit it. Goes through all the motions, no error
messages, but no updates in the db. Yest, as I said, at the same time I
can still edit "fresh" data so the queries must be fine AND I can edit
the data directly.

I've never encountered this before so any suggestions It's like the
data is tied to a certain session or something. 

I hope that makes sense.

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



Re: [PHP] Stumped

2003-11-30 Thread Brian V Bonini
On Sun, 2003-11-30 at 19:21, Robert Cummings wrote:
> On Sun, 2003-11-30 at 18:45, Brian V Bonini wrote:
> > Warning: Invalid argument supplied for foreach() in
> > /usr/local/www/vhosts/pa.eastcoastbicycles.com/htdocs/mainfile.php on
> > line 42
> > 
> > Warning: Invalid argument supplied for foreach() in
> > /usr/local/www/vhosts/pa.eastcoastbicycles.com/htdocs/mainfile.php on
> > line 57
> > 
> > 42: foreach ($_GET as $secvalue) {
> > 57: foreach ($_POST as $secvalue) {
> > 
> > %less php.ini
> > register_globals = On
> > 
> > %./php -i | grep -i globals
> > register_globals => On => On
> 
> Which version of PHP?


Yup, that was the issue.. ;-) It was 4.0.something (old) so I installed
a 4.3.x version and it's good to go. Thanks!

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



Re: [PHP] Stumped

2003-11-30 Thread Robert Cummings
On Sun, 2003-11-30 at 18:45, Brian V Bonini wrote:
> Warning: Invalid argument supplied for foreach() in
> /usr/local/www/vhosts/pa.eastcoastbicycles.com/htdocs/mainfile.php on
> line 42
> 
> Warning: Invalid argument supplied for foreach() in
> /usr/local/www/vhosts/pa.eastcoastbicycles.com/htdocs/mainfile.php on
> line 57
> 
> 42: foreach ($_GET as $secvalue) {
> 57: foreach ($_POST as $secvalue) {
> 
> %less php.ini
> register_globals = On
> 
> %./php -i | grep -i globals
> register_globals => On => On

Which version of PHP?

Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] Stumped

2003-11-30 Thread Brian V Bonini
Warning: Invalid argument supplied for foreach() in
/usr/local/www/vhosts/pa.eastcoastbicycles.com/htdocs/mainfile.php on
line 42

Warning: Invalid argument supplied for foreach() in
/usr/local/www/vhosts/pa.eastcoastbicycles.com/htdocs/mainfile.php on
line 57

42: foreach ($_GET as $secvalue) {
57: foreach ($_POST as $secvalue) {

%less php.ini
register_globals = On

%./php -i | grep -i globals
register_globals => On => On

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



Re: [PHP] Stumped

2003-11-30 Thread Jason Wong
Please use a DESCRIPTIVE subject!

On Monday 01 December 2003 02:51, Brian V Bonini wrote:
> Warning: Invalid argument supplied for foreach() in
> /usr/local/www/vhosts/pa.eastcoastbicycles.com/htdocs/mainfile.php on
> line 42
>
> Warning: Invalid argument supplied for foreach() in
> /usr/local/www/vhosts/pa.eastcoastbicycles.com/htdocs/mainfile.php on
> line 57
>
> 42: foreach ($_GET as $secvalue) {
> 57: foreach ($_POST as $secvalue) {
>
> %less php.ini
> register_globals = On
>
> %./php -i | grep -i globals
> register_globals => On => On

What does phpversion() show? 

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
"Indecision is the basis of flexibility"
-- button at a Science Fiction convention.
*/

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



[PHP] Stumped

2003-11-30 Thread Brian V Bonini
Warning: Invalid argument supplied for foreach() in
/usr/local/www/vhosts/pa.eastcoastbicycles.com/htdocs/mainfile.php on
line 42

Warning: Invalid argument supplied for foreach() in
/usr/local/www/vhosts/pa.eastcoastbicycles.com/htdocs/mainfile.php on
line 57

42: foreach ($_GET as $secvalue) {
57: foreach ($_POST as $secvalue) {

%less php.ini
register_globals = On

%./php -i | grep -i globals
register_globals => On => On

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



Re: [PHP] stumped on mysql_num_rows

2003-06-13 Thread Jason Wong
On Saturday 14 June 2003 01:55, Global I.S. S.A. wrote:

> The issue appears to be that no rows are being found with mysql_num_rows
> using the SQL LIMIT offset. There should be rows found. Further, all
> processing just halts, and no query is shown as per the code here:
>
>
> // RUN THE QUERY TO RETRIEVE EACH FOUND RECORD
> $queryResultHandle = mysql_query($concatquery, $link_identifier) or die (
> mysql_error()); // make sure that we recieved some data from our query

print out $concatquery to verify that it contains what you expect.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
It's useless to try to hold some people to anything they say while they're
madly in love, drunk, or running for office.
*/


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



Re: [PHP] Stumped @ MySql insert query

2003-06-13 Thread Zak Johnson
On 2003-06-13 14:42-0400, Pushpinder Singh Garcha wrote:
> How is variable poisoning possible when using $_POST  ?? I always felt 
> that the php compiler should check to see if the variable was part of 
> the POST Global array. At least this is is what I thought about the 
> $_POST global array.

It will do so only if magic_quotes_gpc is on.  I tend not to rely on
that, especially when we have mysql_escape_string() easily available.

-Zak

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



Re: [PHP] Stumped @ MySql insert query

2003-06-13 Thread Pushpinder Singh Garcha
On Friday, June 13, 2003, at 02:22 PM, Zak Johnson wrote:

$_POST variables are still subject to poisoning; in your case, SQL
injection.
How is variable poisoning possible when using $_POST  ?? I always felt 
that the php compiler should check to see if the variable was part of 
the POST Global array. At least this is is what I thought about the 
$_POST global array.

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


RE: [PHP] Stumped @ MySql insert query

2003-06-13 Thread Jay Blanchard
[snip]
 $sql1 = "INSERT INTO `contacts`

VALUES (
   $_POST['company'],
   $_POST['pri_name'],
   $_POST['sec_name'],
   $_POST['assistant_1'],
   $_POST['assistant_2'],
   $_POST['pri_practice'],
[/snip]

 $sql1 = "INSERT INTO `contacts` (you, should, have, some, column,
names, here, in parentheses)

VALUES (
   '" . $_POST['company'] . "', 
   '" . $_POST['pri_name'] . "',
   '" . $_POST['sec_name'] . "',
   '" . $_POST['assistant_1'] . "',
   '" . $_POST['assistant_2'] . "',
   '" . $_POST['pri_practice'] . "',

etcetera

HTH!

Jay

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



Re: [PHP] Stumped @ MySql insert query

2003-06-13 Thread Zak Johnson
On 2003-06-13 14:15-0400, Pushpinder Singh Garcha wrote:
>  I am trying to execute a simple query using $_POST variables, so 
> that variable poisoning is not possible. note: I have register_globals 
> ON on my site. I am getting the error shown below . Please advise ... 
> as I can't seem to figure out why !

$_POST variables are still subject to poisoning; in your case, SQL
injection.  The error you're getting, however, is because you have not
enclosed your quoted variable references with braces.  For example:

  

You should be passing each of those variables through
mysql_escape_string() before using them in a query.

-Zak

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



[PHP] Stumped @ MySql insert query

2003-06-13 Thread Pushpinder Singh Garcha
Hello everyone,

 I am trying to execute a simple query using $_POST variables, so 
that variable poisoning is not possible. note: I have register_globals 
ON on my site. I am getting the error shown below . Please advise ... 
as I can't seem to figure out why !



// connect to the BD/Table etc

  // Formulate the query

$sql1 = "INSERT INTO `contacts`

VALUES (
   $_POST['company'],
   $_POST['pri_name'],
   $_POST['sec_name'],
   $_POST['assistant_1'],
   $_POST['assistant_2'],
   $_POST['pri_practice'],
   $_POST['sec_practice'],
   $_POST['sic'],
   $_POST['date_established'],
   $_POST['size'],
   $_POST['phone_1'],
   $_POST['phone_2'],
   $_POST['phone_3'],
   $_POST['email_1'],
   $_POST['email_2'],
   $_POST['email_3'],
   $_POST['url'],
   $_POST['city'],
   $_POST['msa'],
   $_POST['status'],
   $_POST['timezone'],
   $_POST['first_contact'],
   $_POST['next_contact'],
   $_POST['last_contact'],
   $_POST['notes'],
   $_POST['email_history'],
   $_POST['battery_started'],
   $_POST['details'],
   TIMESTAMP();
   $_POST['source']
)";


$result1 = mysql_query($sql1)
or die ( 'Database Error has occured.');

$num_results = mysql_num_rows($result1);
echo $num_results." rows added !!";

?>   
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or 
`T_NUM_STRING' in /home/ABCD/CRM/add.php

Thanks in advance.
Pushpinder





Re: [PHP] stumped on mysql_num_rows

2003-06-13 Thread Alex Earl
Can you give us the query too?

Alex


> Hello List,
> The issue appears to be that no rows are being found with mysql_num_rows
> using the SQL LIMIT offset. There should be rows found. Further, all
> processing just halts, and no query is shown as per the code here:
>
>
> // RUN THE QUERY TO RETRIEVE EACH FOUND RECORD
> $queryResultHandle = mysql_query($concatquery, $link_identifier) or die (
> mysql_error());
> // make sure that we recieved some data from our query
> $rows = mysql_num_rows ($queryResultHandle);
> if ( $rows > 0 ) { //    THIS IS WHERE THE SCRIPT FAILS
>while ($data = mysql_fetch_array ($queryResultHandle)) {
>   /* /
>   // COMMON VARIABLE ASSIGNMENT BLOCK - start
>   $yflastupdate = $data["lastupdate"]; // and other fields too ...
>   // COMMON VARIABLE ASSIGNMENT BLOCK - end
>    */
>   include("showOneRecord.php");  // display the row values in a
> template
>} // while
>// mysql_free_result ($queryResultHandle);
> }else{
>echo"Process anomaly. Please try again.";
>echo $query;
>exit;
> }
>
>
> The result is intermittent failure with the message "Process anomaly.
> Please try again." when the first or subsequent "next page" button is
> clicked. No query shown with the failure, and a query should be shown.
>
>
> CONFIGURATION
> This issue is experienced intermittently on the developer production site
> and "always" on the customer  localhost and production sites. The customer
> is using "I just recently installed PHP and mySQL so they are pretty close
> to the latest versions.  I think it's PHP 4.3.1 and mySQL 4.0.13. I get
> the same error on both the first time I click the "More Results" button.
> My browser is IE 6.0.2800 SP1."
>
>
> What's the problem?
>
>
> Richard
> Information Services
> Global I.S. S.A.
> [EMAIL PROTECTED]
> ---
> Globalissa B2B Websites
> http://phpyellow.com
> http://www.dreamriver.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



[PHP] stumped on mysql_num_rows

2003-06-13 Thread Global I.S. S.A.
Hello List,
The issue appears to be that no rows are being found with mysql_num_rows using the SQL 
LIMIT offset. There should be rows found. Further, all processing just halts, and no 
query is shown as per the code here:


// RUN THE QUERY TO RETRIEVE EACH FOUND RECORD
$queryResultHandle = mysql_query($concatquery, $link_identifier) or die ( 
mysql_error()); 
// make sure that we recieved some data from our query 
$rows = mysql_num_rows ($queryResultHandle);
if ( $rows > 0 ) { //    THIS IS WHERE THE SCRIPT FAILS
   while ($data = mysql_fetch_array ($queryResultHandle)) {
  /* /
  // COMMON VARIABLE ASSIGNMENT BLOCK - start 
  $yflastupdate = $data["lastupdate"]; // and other fields too ...
  // COMMON VARIABLE ASSIGNMENT BLOCK - end
   */
  include("showOneRecord.php");  // display the row values in a template
   } // while
   // mysql_free_result ($queryResultHandle);
}else{
   echo"Process anomaly. Please try again.";
   echo $query;
   exit;
}


The result is intermittent failure with the message "Process anomaly. Please try 
again." when the first or subsequent "next page" button is clicked. No query shown 
with the failure, and a query should be shown.


CONFIGURATION
This issue is experienced intermittently on the developer production site and "always" 
on the customer  localhost and production sites. The customer is using "I just 
recently installed PHP and mySQL so they are pretty close to the latest versions.  I 
think it's PHP 4.3.1 and mySQL 4.0.13. I get the same error on both the first time I 
click the "More Results" button. My browser is IE 6.0.2800 SP1."


What's the problem?


Richard
Information Services
Global I.S. S.A.
[EMAIL PROTECTED]
---
Globalissa B2B Websites
http://phpyellow.com
http://www.dreamriver.com




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



RE: [PHP] Stumped...

2003-01-08 Thread Sean Malloy

Please note the single quotes.

Using double quotes:

$variable = $_POST["$var"];

will not work, because you don't have a variable named $var in your code.

Have a look at

http://www.php.net/manual/en/language.types.string.php



-Original Message-
From: Sean Malloy [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 9 January 2003 3:18 PM
To: Stephen; PHP List
Subject: RE: [PHP] Stumped...


Don't write code which requires register_globals to be on.

$variable = $_POST['$var'];


-Original Message-
From: Stephen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 9 January 2003 3:03 PM
To: Timothy Hitchens (HiTCHO)
Cc: PHP List
Subject: Re: [PHP] Stumped...


Ok, I decided another easier way to do it but I have a problem now. Since
the text field contains a $ sign, PHP wants to take it as a variable so it
prints out nothing... Here's my code for getting the value to import into
the table:

$variable = '';
for($i = 1; $i <= $vars; $i++) {
 $tempvar = 'var'.$i;
 $variable .= $$tempvar.',';
}

All this gives me is this since I have three fields input:

,,,

Even if I substr() out the $ sign, it still gives a blank value. Anyone have
any ideas how to fix this?


- Original Message -
From: "Timothy Hitchens (HiTCHO)" <[EMAIL PROTECTED]>
To: "'Stephen'" <[EMAIL PROTECTED]>
Sent: Wednesday, January 08, 2003 9:30 PM
Subject: RE: [PHP] Stumped...


: The issue with the serialise option is that is you have then in a row
: they are serialised
: and you can't do "SELECT * FROM accounts WHERE num_rec LIKE '5'"  you
: would have to create
: two tables as per my previous idea or you can simple implode into a coma
: separated string
: and put into database and then you could use LIKE as per above.
:
:
:
: Timothy Hitchens (HiTCHO)
: Open Platform Consulting
: e-mail: [EMAIL PROTECTED]
:
: > -Original Message-
: > From: Stephen [mailto:[EMAIL PROTECTED]]
: > Sent: Thursday, 9 January 2003 12:28 PM
: > To: Timothy Hitchens (HiTCHO)
: > Subject: Re: [PHP] Stumped...
: >
: >
: > Thank you much, but what did you mean I can't store numbers
: > up to 45, 768, etc?
: > - Original Message -----
: > From: "Timothy Hitchens (HiTCHO)" <[EMAIL PROTECTED]>
: > To: "'PHP List'" <[EMAIL PROTECTED]>
: > Sent: Wednesday, January 08, 2003 9:21 PM
: > Subject: RE: [PHP] Stumped...
: >
: >
: > : Check out:
: > :
: > : http://www.php.net/manual/en/function.serialize.php
: > :
: > : Timothy Hitchens (HiTCHO)
: > : Open Platform Consulting
: > : e-mail: [EMAIL PROTECTED]
: > :
: > : > -Original Message-
: > : > From: Stephen [mailto:[EMAIL PROTECTED]]
: > : > Sent: Thursday, 9 January 2003 12:13 PM
: > : > To: Timothy Hitchens (HiTCHO)
: > : > Cc: PHP List
: > : > Subject: Re: [PHP] Stumped...
: > : >
: > : >
: > : > How would I serialise it? I can make the numbers into an
: > : > array, but if I echo the array itself, I'd get "Array" and I
: > : > need the number in the db, not the word...
: > : >
: > : >
: > : > - Original Message -
: > : > From: "Timothy Hitchens (HiTCHO)" <[EMAIL PROTECTED]>
: > : > To: "'Stephen'" <[EMAIL PROTECTED]>
: > : > Cc: "'PHP List'" <[EMAIL PROTECTED]>
: > : > Sent: Wednesday, January 08, 2003 9:09 PM
: > : > Subject: RE: [PHP] Stumped...
: > : >
: > : >
: > : > : What you can do it simply get the data and create an array
: > : > serialise the
: > : > : array and sent it to
: > : > : the database ... the issue that arises from this is
: > that you can't
: > : > : select if that record has
: > : > : 45 and 786 etc etc
: > : > :
: > : > : The other option you have is to create a table then a
: > : > second table that
: > : > : has entries that show
: > : > : you which numbers it has:
: > : > :
: > : > : Table 1:
: > : > :
: > : > : Code
: > : > : Name
: > : > : etc
: > : > :
: > : > : Table 2:
: > : > :
: > : > : Code
: > : > : Number
: > : > :
: > : > : You will end up with multiple numbers listed in table 2 but
: > : > you can then
: > : > : easily find everyone with number 45.
: > : > :
: > : > :
: > : > :
: > : > : Timothy Hitchens (HiTCHO)
: > : > : Open Platform Consulting
: > : > : e-mail: [EMAIL PROTECTED]
: > : > :
: > : > : > -Original Message-
: > : > : > From: Stephen [mailto:[EMAIL PROTECTED]]
: > : > : > Sent: Thursday, 9 January 2003 12:

RE: [PHP] Stumped...

2003-01-08 Thread Sean Malloy
Don't write code which requires register_globals to be on.

$variable = $_POST['$var'];


-Original Message-
From: Stephen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 9 January 2003 3:03 PM
To: Timothy Hitchens (HiTCHO)
Cc: PHP List
Subject: Re: [PHP] Stumped...


Ok, I decided another easier way to do it but I have a problem now. Since
the text field contains a $ sign, PHP wants to take it as a variable so it
prints out nothing... Here's my code for getting the value to import into
the table:

$variable = '';
for($i = 1; $i <= $vars; $i++) {
 $tempvar = 'var'.$i;
 $variable .= $$tempvar.',';
}

All this gives me is this since I have three fields input:

,,,

Even if I substr() out the $ sign, it still gives a blank value. Anyone have
any ideas how to fix this?


- Original Message -
From: "Timothy Hitchens (HiTCHO)" <[EMAIL PROTECTED]>
To: "'Stephen'" <[EMAIL PROTECTED]>
Sent: Wednesday, January 08, 2003 9:30 PM
Subject: RE: [PHP] Stumped...


: The issue with the serialise option is that is you have then in a row
: they are serialised
: and you can't do "SELECT * FROM accounts WHERE num_rec LIKE '5'"  you
: would have to create
: two tables as per my previous idea or you can simple implode into a coma
: separated string
: and put into database and then you could use LIKE as per above.
:
:
:
: Timothy Hitchens (HiTCHO)
: Open Platform Consulting
: e-mail: [EMAIL PROTECTED]
:
: > -Original Message-
: > From: Stephen [mailto:[EMAIL PROTECTED]]
: > Sent: Thursday, 9 January 2003 12:28 PM
: > To: Timothy Hitchens (HiTCHO)
: > Subject: Re: [PHP] Stumped...
: >
: >
: > Thank you much, but what did you mean I can't store numbers
: > up to 45, 768, etc?
: > - Original Message -
: > From: "Timothy Hitchens (HiTCHO)" <[EMAIL PROTECTED]>
: > To: "'PHP List'" <[EMAIL PROTECTED]>
: > Sent: Wednesday, January 08, 2003 9:21 PM
: > Subject: RE: [PHP] Stumped...
: >
: >
: > : Check out:
: > :
: > : http://www.php.net/manual/en/function.serialize.php
: > :
: > : Timothy Hitchens (HiTCHO)
: > : Open Platform Consulting
: > : e-mail: [EMAIL PROTECTED]
: > :
: > : > -Original Message-
: > : > From: Stephen [mailto:[EMAIL PROTECTED]]
: > : > Sent: Thursday, 9 January 2003 12:13 PM
: > : > To: Timothy Hitchens (HiTCHO)
: > : > Cc: PHP List
: > : > Subject: Re: [PHP] Stumped...
: > : >
: > : >
: > : > How would I serialise it? I can make the numbers into an
: > : > array, but if I echo the array itself, I'd get "Array" and I
: > : > need the number in the db, not the word...
: > : >
: > : >
: > : > - Original Message -
: > : > From: "Timothy Hitchens (HiTCHO)" <[EMAIL PROTECTED]>
: > : > To: "'Stephen'" <[EMAIL PROTECTED]>
: > : > Cc: "'PHP List'" <[EMAIL PROTECTED]>
: > : > Sent: Wednesday, January 08, 2003 9:09 PM
: > : > Subject: RE: [PHP] Stumped...
: > : >
: > : >
: > : > : What you can do it simply get the data and create an array
: > : > serialise the
: > : > : array and sent it to
: > : > : the database ... the issue that arises from this is
: > that you can't
: > : > : select if that record has
: > : > : 45 and 786 etc etc
: > : > :
: > : > : The other option you have is to create a table then a
: > : > second table that
: > : > : has entries that show
: > : > : you which numbers it has:
: > : > :
: > : > : Table 1:
: > : > :
: > : > : Code
: > : > : Name
: > : > : etc
: > : > :
: > : > : Table 2:
: > : > :
: > : > : Code
: > : > : Number
: > : > :
: > : > : You will end up with multiple numbers listed in table 2 but
: > : > you can then
: > : > : easily find everyone with number 45.
: > : > :
: > : > :
: > : > :
: > : > : Timothy Hitchens (HiTCHO)
: > : > : Open Platform Consulting
: > : > : e-mail: [EMAIL PROTECTED]
: > : > :
: > : > : > -Original Message-----
: > : > : > From: Stephen [mailto:[EMAIL PROTECTED]]
: > : > : > Sent: Thursday, 9 January 2003 12:00 PM
: > : > : > To: Timothy Hitchens (HiTCHO)
: > : > : > Cc: PHP List
: > : > : > Subject: Re: [PHP] Stumped...
: > : > : >
: > : > : >
: > : > : > I will later select them and display them to be edited, but
: > : > : > other then that, not really...
: > : > : >
: > : > : >
: > : > : > - Original Message -
: > : > :

Re: [PHP] Stumped...

2003-01-08 Thread Stephen
Ok, I decided another easier way to do it but I have a problem now. Since
the text field contains a $ sign, PHP wants to take it as a variable so it
prints out nothing... Here's my code for getting the value to import into
the table:

$variable = '';
for($i = 1; $i <= $vars; $i++) {
 $tempvar = 'var'.$i;
 $variable .= $$tempvar.',';
}

All this gives me is this since I have three fields input:

,,,

Even if I substr() out the $ sign, it still gives a blank value. Anyone have
any ideas how to fix this?


- Original Message -
From: "Timothy Hitchens (HiTCHO)" <[EMAIL PROTECTED]>
To: "'Stephen'" <[EMAIL PROTECTED]>
Sent: Wednesday, January 08, 2003 9:30 PM
Subject: RE: [PHP] Stumped...


: The issue with the serialise option is that is you have then in a row
: they are serialised
: and you can't do "SELECT * FROM accounts WHERE num_rec LIKE '5'"  you
: would have to create
: two tables as per my previous idea or you can simple implode into a coma
: separated string
: and put into database and then you could use LIKE as per above.
:
:
:
: Timothy Hitchens (HiTCHO)
: Open Platform Consulting
: e-mail: [EMAIL PROTECTED]
:
: > -Original Message-
: > From: Stephen [mailto:[EMAIL PROTECTED]]
: > Sent: Thursday, 9 January 2003 12:28 PM
: > To: Timothy Hitchens (HiTCHO)
: > Subject: Re: [PHP] Stumped...
: >
: >
: > Thank you much, but what did you mean I can't store numbers
: > up to 45, 768, etc?
: > - Original Message -
: > From: "Timothy Hitchens (HiTCHO)" <[EMAIL PROTECTED]>
: > To: "'PHP List'" <[EMAIL PROTECTED]>
: > Sent: Wednesday, January 08, 2003 9:21 PM
: > Subject: RE: [PHP] Stumped...
: >
: >
: > : Check out:
: > :
: > : http://www.php.net/manual/en/function.serialize.php
: > :
: > : Timothy Hitchens (HiTCHO)
: > : Open Platform Consulting
: > : e-mail: [EMAIL PROTECTED]
: > :
: > : > -Original Message-
: > : > From: Stephen [mailto:[EMAIL PROTECTED]]
: > : > Sent: Thursday, 9 January 2003 12:13 PM
: > : > To: Timothy Hitchens (HiTCHO)
: > : > Cc: PHP List
: > : > Subject: Re: [PHP] Stumped...
: > : >
: > : >
: > : > How would I serialise it? I can make the numbers into an
: > : > array, but if I echo the array itself, I'd get "Array" and I
: > : > need the number in the db, not the word...
: > : >
: > : >
: > : > - Original Message -
: > : > From: "Timothy Hitchens (HiTCHO)" <[EMAIL PROTECTED]>
: > : > To: "'Stephen'" <[EMAIL PROTECTED]>
: > : > Cc: "'PHP List'" <[EMAIL PROTECTED]>
: > : > Sent: Wednesday, January 08, 2003 9:09 PM
: > : > Subject: RE: [PHP] Stumped...
: > : >
: > : >
: > : > : What you can do it simply get the data and create an array
: > : > serialise the
: > : > : array and sent it to
: > : > : the database ... the issue that arises from this is
: > that you can't
: > : > : select if that record has
: > : > : 45 and 786 etc etc
: > : > :
: > : > : The other option you have is to create a table then a
: > : > second table that
: > : > : has entries that show
: > : > : you which numbers it has:
: > : > :
: > : > : Table 1:
: > : > :
: > : > : Code
: > : > : Name
: > : > : etc
: > : > :
: > : > : Table 2:
: > : > :
: > : > : Code
: > : > : Number
: > : > :
: > : > : You will end up with multiple numbers listed in table 2 but
: > : > you can then
: > : > : easily find everyone with number 45.
: > : > :
: > : > :
: > : > :
: > : > : Timothy Hitchens (HiTCHO)
: > : > : Open Platform Consulting
: > : > : e-mail: [EMAIL PROTECTED]
: > : > :
: > : > : > -Original Message-
: > : > : > From: Stephen [mailto:[EMAIL PROTECTED]]
: > : > : > Sent: Thursday, 9 January 2003 12:00 PM
: > : > : > To: Timothy Hitchens (HiTCHO)
: > : > : > Cc: PHP List
: > : > : > Subject: Re: [PHP] Stumped...
: > : > : >
: > : > : >
: > : > : > I will later select them and display them to be edited, but
: > : > : > other then that, not really...
: > : > : >
: > : > : >
: > : > : > - Original Message -
: > : > : > From: "Timothy Hitchens (HiTCHO)" <[EMAIL PROTECTED]>
: > : > : > To: "'Stephen'" <[EMAIL PROTECTED]>; "'PHP List'"
: > : > : > <[EMAIL PROTECTED]>
: > : > : > Sent: Wednesday, January 08, 20

RE: [PHP] Stumped...

2003-01-08 Thread Timothy Hitchens \(HiTCHO\)
Check out:

http://www.php.net/manual/en/function.serialize.php

Timothy Hitchens (HiTCHO)
Open Platform Consulting
e-mail: [EMAIL PROTECTED]

> -Original Message-
> From: Stephen [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, 9 January 2003 12:13 PM
> To: Timothy Hitchens (HiTCHO)
> Cc: PHP List
> Subject: Re: [PHP] Stumped...
> 
> 
> How would I serialise it? I can make the numbers into an 
> array, but if I echo the array itself, I'd get "Array" and I 
> need the number in the db, not the word...
> 
> 
> - Original Message -
> From: "Timothy Hitchens (HiTCHO)" <[EMAIL PROTECTED]>
> To: "'Stephen'" <[EMAIL PROTECTED]>
> Cc: "'PHP List'" <[EMAIL PROTECTED]>
> Sent: Wednesday, January 08, 2003 9:09 PM
> Subject: RE: [PHP] Stumped...
> 
> 
> : What you can do it simply get the data and create an array 
> serialise the
> : array and sent it to
> : the database ... the issue that arises from this is that you can't
> : select if that record has
> : 45 and 786 etc etc
> :
> : The other option you have is to create a table then a 
> second table that
> : has entries that show
> : you which numbers it has:
> :
> : Table 1:
> :
> : Code
> : Name
> : etc
> :
> : Table 2:
> :
> : Code
> : Number
> :
> : You will end up with multiple numbers listed in table 2 but 
> you can then
> : easily find everyone with number 45.
> :
> :
> :
> : Timothy Hitchens (HiTCHO)
> : Open Platform Consulting
> : e-mail: [EMAIL PROTECTED]
> :
> : > -Original Message-
> : > From: Stephen [mailto:[EMAIL PROTECTED]]
> : > Sent: Thursday, 9 January 2003 12:00 PM
> : > To: Timothy Hitchens (HiTCHO)
> : > Cc: PHP List
> : > Subject: Re: [PHP] Stumped...
> : >
> : >
> : > I will later select them and display them to be edited, but
> : > other then that, not really...
> : >
> : >
> : > - Original Message -
> : > From: "Timothy Hitchens (HiTCHO)" <[EMAIL PROTECTED]>
> : > To: "'Stephen'" <[EMAIL PROTECTED]>; "'PHP List'"
> : > <[EMAIL PROTECTED]>
> : > Sent: Wednesday, January 08, 2003 8:58 PM
> : > Subject: RE: [PHP] Stumped...
> : >
> : >
> : > : Do you require searching of this data eg... select via
> : > these numbers or
> : > : not??
> : > :
> : > :
> : > : Timothy Hitchens (HiTCHO)
> : > : Open Platform Consulting
> : > : e-mail: [EMAIL PROTECTED]
> : > :
> : > :
> : > : -Original Message-
> : > : From: Stephen [mailto:[EMAIL PROTECTED]]
> : > : Sent: Thursday, 9 January 2003 11:56 AM
> : > : To: PHP List
> : > : Subject: [PHP] Stumped...
> : > :
> : > :
> : > : Sorry for so many questions but this should be the last one
> : > for a while.
> : > :
> : > : I have a form that I want to insert into a MySQL table. 
> This form is
> : > : based on how many entries a user wants to enter. For 
> example, a user
> : > : wants to type in 12 names, so 12 form fields appear. Or
> : > they want 50, 50
> : > : appear. What I want to do is store them all into a 
> database, but for
> : > : one, I can't quit figure out how I can insert them, and
> : > second, even if
> : > : I did know how, I couldn't possibly make enough tables
> : > unless I made 999
> : > : since I put the char limit to 3 digits. How could I work
> : > this keeping in
> : > : mine any number between 1 and 999 could be entered and
> : > without making
> : > : 999 tables?
> : > :
> : > : Thanks,
> : > : Stephen Craton
> : > : http://www.melchior.us
> : > :
> : > : "What's the point in appearance if your true love, doesn't
> : > care about
> : > : it?" -- 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] Stumped...

2003-01-08 Thread Stephen
How would I serialise it? I can make the numbers into an array, but if I
echo the array itself, I'd get "Array" and I need the number in the db, not
the word...


- Original Message -
From: "Timothy Hitchens (HiTCHO)" <[EMAIL PROTECTED]>
To: "'Stephen'" <[EMAIL PROTECTED]>
Cc: "'PHP List'" <[EMAIL PROTECTED]>
Sent: Wednesday, January 08, 2003 9:09 PM
Subject: RE: [PHP] Stumped...


: What you can do it simply get the data and create an array serialise the
: array and sent it to
: the database ... the issue that arises from this is that you can't
: select if that record has
: 45 and 786 etc etc
:
: The other option you have is to create a table then a second table that
: has entries that show
: you which numbers it has:
:
: Table 1:
:
: Code
: Name
: etc
:
: Table 2:
:
: Code
: Number
:
: You will end up with multiple numbers listed in table 2 but you can then
: easily find everyone with number 45.
:
:
:
: Timothy Hitchens (HiTCHO)
: Open Platform Consulting
: e-mail: [EMAIL PROTECTED]
:
: > -Original Message-
: > From: Stephen [mailto:[EMAIL PROTECTED]]
: > Sent: Thursday, 9 January 2003 12:00 PM
: > To: Timothy Hitchens (HiTCHO)
: > Cc: PHP List
: > Subject: Re: [PHP] Stumped...
: >
: >
: > I will later select them and display them to be edited, but
: > other then that, not really...
: >
: >
: > - Original Message -
: > From: "Timothy Hitchens (HiTCHO)" <[EMAIL PROTECTED]>
: > To: "'Stephen'" <[EMAIL PROTECTED]>; "'PHP List'"
: > <[EMAIL PROTECTED]>
: > Sent: Wednesday, January 08, 2003 8:58 PM
: > Subject: RE: [PHP] Stumped...
: >
: >
: > : Do you require searching of this data eg... select via
: > these numbers or
: > : not??
: > :
: > :
: > : Timothy Hitchens (HiTCHO)
: > : Open Platform Consulting
: > : e-mail: [EMAIL PROTECTED]
: > :
: > :
: > : -Original Message-
: > : From: Stephen [mailto:[EMAIL PROTECTED]]
: > : Sent: Thursday, 9 January 2003 11:56 AM
: > : To: PHP List
: > : Subject: [PHP] Stumped...
: > :
: > :
: > : Sorry for so many questions but this should be the last one
: > for a while.
: > :
: > : I have a form that I want to insert into a MySQL table. This form is
: > : based on how many entries a user wants to enter. For example, a user
: > : wants to type in 12 names, so 12 form fields appear. Or
: > they want 50, 50
: > : appear. What I want to do is store them all into a database, but for
: > : one, I can't quit figure out how I can insert them, and
: > second, even if
: > : I did know how, I couldn't possibly make enough tables
: > unless I made 999
: > : since I put the char limit to 3 digits. How could I work
: > this keeping in
: > : mine any number between 1 and 999 could be entered and
: > without making
: > : 999 tables?
: > :
: > : Thanks,
: > : Stephen Craton
: > : http://www.melchior.us
: > :
: > : "What's the point in appearance if your true love, doesn't
: > care about
: > : it?" -- http://www.melchior.us
: > :
: > :
: > :
: >
: >
:
:
:



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




RE: [PHP] Stumped...

2003-01-08 Thread Timothy Hitchens \(HiTCHO\)
What you can do it simply get the data and create an array serialise the
array and sent it to
the database ... the issue that arises from this is that you can't
select if that record has
45 and 786 etc etc

The other option you have is to create a table then a second table that
has entries that show
you which numbers it has:

Table 1:

Code 
Name
etc

Table 2:

Code
Number

You will end up with multiple numbers listed in table 2 but you can then
easily find everyone with number 45.



Timothy Hitchens (HiTCHO)
Open Platform Consulting
e-mail: [EMAIL PROTECTED]

> -Original Message-
> From: Stephen [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, 9 January 2003 12:00 PM
> To: Timothy Hitchens (HiTCHO)
> Cc: PHP List
> Subject: Re: [PHP] Stumped...
> 
> 
> I will later select them and display them to be edited, but 
> other then that, not really...
> 
> 
> - Original Message -
> From: "Timothy Hitchens (HiTCHO)" <[EMAIL PROTECTED]>
> To: "'Stephen'" <[EMAIL PROTECTED]>; "'PHP List'" 
> <[EMAIL PROTECTED]>
> Sent: Wednesday, January 08, 2003 8:58 PM
> Subject: RE: [PHP] Stumped...
> 
> 
> : Do you require searching of this data eg... select via 
> these numbers or
> : not??
> :
> :
> : Timothy Hitchens (HiTCHO)
> : Open Platform Consulting
> : e-mail: [EMAIL PROTECTED]
> :
> :
> : -Original Message-
> : From: Stephen [mailto:[EMAIL PROTECTED]]
> : Sent: Thursday, 9 January 2003 11:56 AM
> : To: PHP List
> : Subject: [PHP] Stumped...
> :
> :
> : Sorry for so many questions but this should be the last one 
> for a while.
> :
> : I have a form that I want to insert into a MySQL table. This form is
> : based on how many entries a user wants to enter. For example, a user
> : wants to type in 12 names, so 12 form fields appear. Or 
> they want 50, 50
> : appear. What I want to do is store them all into a database, but for
> : one, I can't quit figure out how I can insert them, and 
> second, even if
> : I did know how, I couldn't possibly make enough tables 
> unless I made 999
> : since I put the char limit to 3 digits. How could I work 
> this keeping in
> : mine any number between 1 and 999 could be entered and 
> without making
> : 999 tables?
> :
> : Thanks,
> : Stephen Craton
> : http://www.melchior.us
> :
> : "What's the point in appearance if your true love, doesn't 
> care about
> : it?" -- http://www.melchior.us
> :
> :
> :
> 
> 


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




Re: [PHP] Stumped...

2003-01-08 Thread Stephen
I will later select them and display them to be edited, but other then that,
not really...


- Original Message -
From: "Timothy Hitchens (HiTCHO)" <[EMAIL PROTECTED]>
To: "'Stephen'" <[EMAIL PROTECTED]>; "'PHP List'"
<[EMAIL PROTECTED]>
Sent: Wednesday, January 08, 2003 8:58 PM
Subject: RE: [PHP] Stumped...


: Do you require searching of this data eg... select via these numbers or
: not??
:
:
: Timothy Hitchens (HiTCHO)
: Open Platform Consulting
: e-mail: [EMAIL PROTECTED]
:
:
: -Original Message-
: From: Stephen [mailto:[EMAIL PROTECTED]]
: Sent: Thursday, 9 January 2003 11:56 AM
: To: PHP List
: Subject: [PHP] Stumped...
:
:
: Sorry for so many questions but this should be the last one for a while.
:
: I have a form that I want to insert into a MySQL table. This form is
: based on how many entries a user wants to enter. For example, a user
: wants to type in 12 names, so 12 form fields appear. Or they want 50, 50
: appear. What I want to do is store them all into a database, but for
: one, I can't quit figure out how I can insert them, and second, even if
: I did know how, I couldn't possibly make enough tables unless I made 999
: since I put the char limit to 3 digits. How could I work this keeping in
: mine any number between 1 and 999 could be entered and without making
: 999 tables?
:
: Thanks,
: Stephen Craton
: http://www.melchior.us
:
: "What's the point in appearance if your true love, doesn't care about
: it?" -- http://www.melchior.us
:
:
:



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




RE: [PHP] Stumped...

2003-01-08 Thread Timothy Hitchens \(HiTCHO\)
Do you require searching of this data eg... select via these numbers or
not??


Timothy Hitchens (HiTCHO)
Open Platform Consulting
e-mail: [EMAIL PROTECTED] 


-Original Message-
From: Stephen [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, 9 January 2003 11:56 AM
To: PHP List
Subject: [PHP] Stumped...


Sorry for so many questions but this should be the last one for a while.

I have a form that I want to insert into a MySQL table. This form is
based on how many entries a user wants to enter. For example, a user
wants to type in 12 names, so 12 form fields appear. Or they want 50, 50
appear. What I want to do is store them all into a database, but for
one, I can't quit figure out how I can insert them, and second, even if
I did know how, I couldn't possibly make enough tables unless I made 999
since I put the char limit to 3 digits. How could I work this keeping in
mine any number between 1 and 999 could be entered and without making
999 tables?

Thanks,
Stephen Craton
http://www.melchior.us

"What's the point in appearance if your true love, doesn't care about
it?" -- http://www.melchior.us


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




[PHP] Stumped...

2003-01-08 Thread Stephen



Sorry for so many questions but this should be the last 
one for a while.
 
I have a form that I want to insert into a MySQL table. This 
form is based on how many entries a user wants to enter. For example, a user 
wants to type in 12 names, so 12 form fields appear. Or they want 50, 50 appear. 
What I want to do is store them all into a database, but for one, I can't quit 
figure out how I can insert them, and second, even if I did know how, I couldn't 
possibly make enough tables unless I made 999 since I put the char limit to 3 
digits. How could I work this keeping in mine any number between 1 and 999 could 
be entered and without making 999 tables?
Thanks,Stephen Cratonhttp://www.melchior.us
 
"What's the point in appearance if your true love, doesn't care about it?" 
-- http://www.melchior.us
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Stumped!

2002-12-16 Thread Chris Shiflett
--- Chris Shiflett <[EMAIL PROTECTED]> wrote:
> --- [EMAIL PROTECTED] wrote:
> > I keep getting a parser error and I can't figure
> > it out. Here is the code and any help is greatly
> > appreciated.
> > 
> > $sql = "SELECT * FROM requests";
> > 
> > while ($result = mysql_fetch_array($query))
> 
> While this is not related to your parse error, it is a
> major logic flaw, as mysql_fetch_array() takes a result
> set
> as an argument, not an SQL statement.
> 
> > echo (" href=\"edit.php?id='$id'\">$meetingName");
> 
> This is your parse error. Get rid of the parentheses.

Actually, the parse error is that you never close the while
loop. Still, the error message would point you in the right
direction.

Chris

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




Re: [PHP] Stumped!

2002-12-16 Thread Chris Shiflett
--- [EMAIL PROTECTED] wrote:
> I keep getting a parser error and I can't figure
> it out. Here is the code and any help is greatly
> appreciated.
> 
> $sql = "SELECT * FROM requests";
> 
> while ($result = mysql_fetch_array($query))

While this is not related to your parse error, it is a
major logic flaw, as mysql_fetch_array() takes a result set
as an argument, not an SQL statement.

> echo ("$meetingName");

This is your parse error. Get rid of the parentheses.

The parse error should tell you on exactly which line you
had an error, so read those error messages carefully next
time.

Good luck.

Chris

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




Re: [PHP] Stumped!

2002-12-16 Thread 1LT John W. Holmes
> I am trying to display a column from my database as a list.  Each listing
> needs to be a URL that links to another script that brings up all of the
data
> in the row to edit.  I keep getting a parser error and I can't figure it
out.
>  Here is the code and any help is greatly appreciated.
>
>  $db = mysql_connect("localhost", "Uname", "PW");
>
> $select_db = mysql_select_db("machmedi_meetingRequest",$db);
> $sql = "SELECT * FROM requests";

You're never executing your query, for one thing...

$res = mysql_query($sql) or die(mysql_error());

> while ($result = mysql_fetch_array($query)) {
> $id= $result["id"];
> $meetingName= $result["meetingName"];
>
> echo ("$meetingName");
> ?>

---John Holmes...


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




[PHP] Stumped!

2002-12-16 Thread CSParker1
I am trying to display a column from my database as a list.  Each listing 
needs to be a URL that links to another script that brings up all of the data 
in the row to edit.  I keep getting a parser error and I can't figure it out. 
 Here is the code and any help is greatly appreciated.

$meetingName");
?>



[PHP] Stumped: vars not passed!!!

2002-08-15 Thread Petre Agenbag

I'm going mad.

I've been trying to implement sessions so it will work backward on my
older 4.0.3 server ( I'm working on a 4.1.2), with no success as of yet,
but I think it's my 4.1.2 that's causing this, as the app in the
following example works perfectly on the older one.

Note, I have explicitly used the manual URl method to pass variables and
NOT the $HTTP_POST_VARS['x'] method as I am suspecting that my
register_globals is not working.

PS, register_globals, track vars etc IS on on both systems.

Look at this:

index.php




 

page1.php
Next


page2.php







page3.php
Username:  
Password:  
Test:  


This DOES NOT work on my 4.1.2 system.

Why?
I know page2 is not needed, but it is still supposed to work right? I
deliberatly put it there to "extend" the path the variable needs to
piggy back to see where I lose them, but on my system it loses the vars
right at the second page already


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




Re: [PHP] Stumped.

2002-06-24 Thread 1LT John W. Holmes

> Are there any other reasons why header() would fail while output
> buffering is off.

What's the error message? It tells you exactly what file and line number
started the output, so that's where you should look...

---John Holmes...



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




Re: [PHP] Stumped.

2002-06-24 Thread Gerard Samuel

Within the function before the header(), no there are no echo or print 
statements.
I do have a few error checking that uses trigger_error() which displays 
a page, but no errors are being triggered.
And just in case, I did check the error_handler file.  There aren't any 
'white space' before or after 
Maybe Im missing something.  I think Ill put it aside and look at it 
when the brain is fresh...

Thanks

Erik Price wrote:

>
> On Monday, June 24, 2002, at 04:15  PM, Gerard Samuel wrote:
>
>> Are there any other reasons why header() would fail while output 
>> buffering is off.
>
>
> Hm... could it be that your user-agent isn't using HTTP 1.1?  Doubtful 
> if you're testing on a browser that was developed in the last couple 
> of years
>
> And there's no other output statements like "print", "printf", or 
> "echo" in your script before the header() line?
>
>
> Erik
>
>
>
> 
>
> Erik Price
> Web Developer Temp
> Media Lab, H.H. Brown
> [EMAIL PROTECTED]
>
>
>

-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/




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




[PHP] Stumped.

2002-06-24 Thread Gerard Samuel

In a file with functions only, one of the functions is structured like ->
function foo()
{
if (isset($_POST['submit']))
{
 /* DO SOME SQL */
 header('location: x');
}
else
{
/* SHOW A FORM HERE */
}
}


I noticed today that when I turned off output buffering, that the header 
redirect doesn't work anymore...
I turned on E_ALL error reporting, and I didn't get any errors.
I checked the file that called on this particular file, and there is no 
'white space' before or after 
I checked all included files that this function calls on and there is no 
'white space' before or after 

Are there any other reasons why header() would fail while output 
buffering is off.

Im running php 4.2.1 on FreeBSD 4.5-R p6
Thanks

-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/



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




Re: [PHP] Stumped on a function

2002-06-21 Thread Jason Soza

To be honest, I didn't know I could format the date within my query. 
For some reason, I was under the assumption that since dates go into 
MySQL in a specific format, that's how they came out.

Anyway, thanks for pointing this out to me! Very helpful.

Jason Soza

- Original Message -
From: Jesper Brunholm <[EMAIL PROTECTED]>
Date: Friday, June 21, 2002 2:02 am
Subject: Re: [PHP] Stumped on a function

> John Holmes wrote:
> > Why don't you just use DATE_FORMAT() in your query, then you 
> don't have
> > to do any extra PHP code at all??
> 
> you might want a link to that:
> <" 
> 
target="l">http://www.mysql.com/doc/D/a/Date_and_time_functions.html> - 
look 
> somewhat below the middle of the page
> 
> >>function cleandate($indate) {
> >>str_replace("-", "/", $indate);
> >>return date("F j, Y", strtotime($indate));
> >>}
> 
> check the $indate - response from the db - if you give invalid 
> data 
> there then it will (probably) use a timestamp instead, whith now()-
> values...
> >> when I echo $newdate using the above code, I get "June 20, 
> 2002" -
> >> today's date.
> 
> Regards
> 
> Jesper Brunholm
> 
> -- 
> Phønix - Danish folk music from young musicians - 
> http://www.phonixfolk.dk
> 
> 
> -- 
> 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] Stumped on a function

2002-06-21 Thread Jesper Brunholm

John Holmes wrote:
> Why don't you just use DATE_FORMAT() in your query, then you don't have
> to do any extra PHP code at all??

you might want a link to that:
 - look 
somewhat below the middle of the page

>>function cleandate($indate) {
>>  str_replace("-", "/", $indate);
>>  return date("F j, Y", strtotime($indate));
>>  }

check the $indate - response from the db - if you give invalid data 
there then it will (probably) use a timestamp instead, whith now()-values...

>> when I echo $newdate using the above code, I get "June 20, 2002" -
>> today's date.

Regards

Jesper Brunholm

-- 
Phønix - Danish folk music from young musicians - http://www.phonixfolk.dk



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




RE: [PHP] Stumped on a function

2002-06-21 Thread John Holmes

Why don't you just use DATE_FORMAT() in your query, then you don't have
to do any extra PHP code at all??

---John Holmes...

> -Original Message-
> From: Jason Soza [mailto:[EMAIL PROTECTED]]
> Sent: Friday, June 21, 2002 3:50 AM
> To: PHP-General Mailing List
> Subject: [PHP] Stumped on a function
> 
> I've been using the following function successfully for months,
tonight I
> literally copied/pasted it to another page I was creating, called it
> exactly
> the same using the same data type, and I'm getting an incorrect
result.
> The
> function is supposed to take a standard MySQL "CCYY-MM-DD" date format
and
> convert it to a "Month Day, CCYY" format. Here's the function code:
> 
> function cleandate($indate) {
>   str_replace("-", "/", $indate);
>   return date("F j, Y", strtotime($indate));
>   }
> 
> And I'm calling it with:
> 
> $newdate = cleandate($birthdate);
> 
> $birthdate is a MySQL DATE field and if I echo "$birthdate" I get
> "2002-11-04", which is what is entered for that $birthdate record.
> However,
> when I echo $newdate using the above code, I get "June 20, 2002" -
today's
> date.
> 
> Now, again I'm using this code as-is successfully on another page. I
don't
> understand why it's returning today's date on this page, but returning
the
> correct date on another page.
> 
> This is the error that PHP is throwing regarding the above code:
> [Thu Jun 20 23:16:38 2002] [error] PHP Warning:  strtotime() called
with
> empty time parameter in test.php on line 19
> 
> Line 19 is the 'return' line in the function. I do not get this error
in
> my
> successful application of this code.
> 
> Any ideas? Thanks in advance...
> 
> Jason Soza
> 
> 
> --
> 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] Stumped on a function

2002-06-21 Thread David Freeman


 > function cleandate($indate) {
 >  str_replace("-", "/", $indate);
 >  return date("F j, Y", strtotime($indate));
 >  }

I suspect that you actually need something like this:

function cleandate($indate) {
  $indate = str_replace("-", "/", $indate);
  return date("F j, Y", strtotime($indate));
}

Although, to be honest, you can probably get away with:

function cleandate($indate) {
  return date("F j, Y", strtotime($indate));
}

And, ultimately, you may even find that you're better off just doing the
date manipulation in mysql instead and leave it at that.

CYA, Dave



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




[PHP] Stumped on a function

2002-06-21 Thread Jason Soza

I've been using the following function successfully for months, tonight I
literally copied/pasted it to another page I was creating, called it exactly
the same using the same data type, and I'm getting an incorrect result. The
function is supposed to take a standard MySQL "CCYY-MM-DD" date format and
convert it to a "Month Day, CCYY" format. Here's the function code:

function cleandate($indate) {
str_replace("-", "/", $indate);
return date("F j, Y", strtotime($indate));
}

And I'm calling it with:

$newdate = cleandate($birthdate);

$birthdate is a MySQL DATE field and if I echo "$birthdate" I get
"2002-11-04", which is what is entered for that $birthdate record. However,
when I echo $newdate using the above code, I get "June 20, 2002" - today's
date.

Now, again I'm using this code as-is successfully on another page. I don't
understand why it's returning today's date on this page, but returning the
correct date on another page.

This is the error that PHP is throwing regarding the above code:
[Thu Jun 20 23:16:38 2002] [error] PHP Warning:  strtotime() called with
empty time parameter in test.php on line 19

Line 19 is the 'return' line in the function. I do not get this error in my
successful application of this code.

Any ideas? Thanks in advance...

Jason Soza


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




[PHP] stumped

2001-05-11 Thread Adrian D'Costa

Hi,

I need to find a solution to this.  I am lost.  To see what I talk about
check vvmm.net/search.php3.  I am using php 4 offline.  Based on whatever
the viewer select I get the below script to build the select statements
accordingly.  Everything is working fine now.  I want to add another
feature where, if the viewer search for a particular city that has
no record I need to display all the cities for that country selected as
alternative choices.  The problem is trying to re-build the select
statements.  I have reduced the checking as the script is too long, but
checking the link earlier mentioned would give an idea.  Each table has a
countryid (contid) and cityid (cityid).   Here is the code, a pls do give
me a clue:)

TIA

Adrian

$tdate = date(Y . "-" . m . "-" . d);


// build search query
if ($vsearch == "c" || $vsearch == "v" || $vsearch == "l") {
$searchStmt = "select ";
}

// get the correct table

switch ($vsearch) {
case "z":
//  this exec only if no choice is selected.
$searchStmt .= "";
break;

case "c":
//  Select vvmmdb table.  Catalog Choice
$searchStmt .= "city.city as destinazione, vvmmdb.days,
vvmmdb.periodo, vvmmdb.vitofferta, vvmmdb.curr1 as curr2, vvmmdb.url,
vvmmdb.stars, vvmmdb.club, vvmmdb.tcode from vvmmdb,city where ";
//  DisplayErrMsg("Catalog Data");
//  exit();
break;

case "v":
//  Select special table.  Vitofferta
$searchStmt .= "city.city as destinazione,
special.periodo, special.date2, special.catalogo, special.hf,
special.curr2, special.vitofferta,special.fh, special.club, special.stars
from special,city where ";
break;

case "l":
//  Select travel table.  Last Minute
$searchStmt .= "travel.tour_operator, city.city as
destinazione, travel.nome_hotel, travel.periodo, travel.notti,
travel.giorni, travel.trattamento, travel.curr2,
travel.vitofferta,travel.club, travel.stars from travel,city
where ";
break;
case "a":
//  select all tables and query.
$searchStmt .= "select travel.tour_operator, city.city as
destinazione, travel.nome_hotel, travel.periodo, travel.notti,
travel.giorni, travel.trattamento, travel.curr2,
travel.vitofferta,travel.club, travel.stars from travel,city where ";
$searchStmt1 .= "select city.city as destinazione,
special.periodo, special.date2, special.catalogo, special.hf,
special.curr2, special.vitofferta, special.fh,special.club,special.stars
from special,city where ";
$searchStmt2 .= "select city.city as destinazione,
vvmmdb.days,
vvmmdb.periodo, vvmmdb.vitofferta, vvmmdb.curr1, vvmmdb.url, vvmmdb.stars,
vvmmdb.club, vvmmdb.tcode from vvmmdb,city where ";
break;

default:
DisplayErrMsg("Error");
break;
}

// Check if destinazione has been entered
if ($dest) {
switch ($vsearch) {
case "z":
  $searchStmt .= "";
break;
case "c":
//  Select vvmmdb table.  Catalog Choice
$searchStmt .= "vvmmdb.cityid=$citycode and ";
break;

case "v":
//  Select special table.  Vitofferta
$searchStmt .= "special.cityid=$citycode and ";
break;

case "l":
//  Select travel table.  Last Minute (travel & flight)
$searchStmt .= "travel.cityid=$citycode and ";
break;

case "a":
//  select all tables and query.
// Check if destinazione has been entered
if ($dest) {
switch ($vsearch) {
case "z":
  $searchStmt .= "";
break;
case "c":
//  Select vvmmdb table.  Catalog Choice
$searchStmt .= "vvmmdb.cityid=$citycode and ";
break;

case "v":
//  Select special table.  Vitofferta
$searchStmt .= "special.cityid=$citycode and ";
break;

case "l":
//  Select travel table.  Last Minute (travel & flight)
$searchStmt .= "travel.cityid=$citycode and ";
break;

case "a":
//  select all tables and query.
//  $searchStmt .= "destinazione like '%$destinazione%' and ";
//  $searchStmt1 .= "destinazione like '%$destinazione%' and
";
$searchStmt .= "travel.cityid=$citycode and ";
$searchStmt1 .= "special.cityid=$citycode and ";
$searchStmt2 .= "vvmmdb.cityid=$citycode and ";
default:
//DisplayErrMsg("Error");
break;
   }

} else {
$searchStmt .= "";
$searchStmt1 .= "";
$searchStmt2 .= "";
}

= I removed the other code and gave the ending -==

$stmt = substr($searchStmt, 0, strlen($searchStmt)-4);
$stmt1 = substr($searchStmt1, 0, strlen($searchStmt1)-4);
$stmt2 = substr($searchStmt2, 0, strlen

Re: [PHP] Stumped Newbie: Can't get results in db query eventhough everything checks - what am I missing?

2001-03-08 Thread Nicole Lallande

Thanks Joe - that showed me right away!! all better now -- on to the
next step..

Nicole


"Joe Sheble (Wizaerd)" wrote:
> 
> I'd start by adding the mysql_error() function in your die() statement...
> $result = mysql_query($sql,$connection) or die ("Couldn't get results: " .
> mysql_error());
> 
> it might give more information to help you find the problem...
> 
> At 10:15 AM 3/8/01 -0800, Nicole Lallande wrote:
> >Greetings,
> >
> >I keep getting the message that I cannot get results.  I have a simple
> >user authentication code that uses a mysql database to authenticate
> >from.  Initially I had the code working when I had the mysql_connect
> >variables in the code itself.  When I moved the connection variables to
> >an include file and then called them as variables, it was necessary to
> >change the variable names in the database (both were initially
> >$username, $password).  Now, while I have the connection and opening the
> >db correct I can't get results.  Here is my code:
> >
> >require("connect.inc.php");
> >
> >$connection = mysql_connect("$hostname","$username","$password") or die
> >("Unable to connect to database.");
> >echo "I'm connected.";
> >**__A-OK here
> >
> >mysql_select_db("dnaUsers") or die ("Unable to select database.");
> >echo "I've opened the dnaUsers db.";
> >echo "$ruser, $rpass"; //this is from the html login form
> >**__Yup, no problem so far -
> >
> >// Formulate the query
> >$sql = "SELECT rep_name FROM reps WHERE username='$ruser' and
> >password='$rpass'";
> >// Execute the query and put the results in $result
> >$result = mysql_query($sql,$connection) or die ("Couldn't get
> >results.");
> >
> >**__Here it is - crash and burn - the database name is correct, the
> >fields are correct, the username and password are in the db and have
> >been input correctly and are even being passed from the form correctly.
> >
> >I have checked the names of all the fields to ensure they match the
> >variables in the query, checked that the values in the fields are
> >correct -  (yes, I have checked that they match.)
> >
> >I have searched the archives but the hard thing about the archives is
> >formulating the question in a way that will yield an answer.  Sorry if
> >this has been asked before.
> >
> >TIA,
> >
> >Nicole
> >--
> >
> >Nicole Lallande
> >[EMAIL PROTECTED]
> >760.753.6766
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 

Nicole Lallande
[EMAIL PROTECTED]
760.753.6766


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Stumped Newbie: Can't get results in db query even though everything checks - what am I missing?

2001-03-08 Thread Joe Sheble (Wizaerd)


I'd start by adding the mysql_error() function in your die() statement...
$result = mysql_query($sql,$connection) or die ("Couldn't get results: " . 
mysql_error());

it might give more information to help you find the problem...

At 10:15 AM 3/8/01 -0800, Nicole Lallande wrote:
>Greetings,
>
>I keep getting the message that I cannot get results.  I have a simple
>user authentication code that uses a mysql database to authenticate
>from.  Initially I had the code working when I had the mysql_connect
>variables in the code itself.  When I moved the connection variables to
>an include file and then called them as variables, it was necessary to
>change the variable names in the database (both were initially
>$username, $password).  Now, while I have the connection and opening the
>db correct I can't get results.  Here is my code:
>
>require("connect.inc.php");
>
>$connection = mysql_connect("$hostname","$username","$password") or die
>("Unable to connect to database.");
>echo "I'm connected.";
>**__A-OK here
>
>mysql_select_db("dnaUsers") or die ("Unable to select database.");
>echo "I've opened the dnaUsers db.";
>echo "$ruser, $rpass"; //this is from the html login form
>**__Yup, no problem so far -
>
>// Formulate the query
>$sql = "SELECT rep_name FROM reps WHERE username='$ruser' and
>password='$rpass'";
>// Execute the query and put the results in $result
>$result = mysql_query($sql,$connection) or die ("Couldn't get
>results.");
>
>**__Here it is - crash and burn - the database name is correct, the
>fields are correct, the username and password are in the db and have
>been input correctly and are even being passed from the form correctly.
>
>I have checked the names of all the fields to ensure they match the
>variables in the query, checked that the values in the fields are
>correct -  (yes, I have checked that they match.)
>
>I have searched the archives but the hard thing about the archives is
>formulating the question in a way that will yield an answer.  Sorry if
>this has been asked before.
>
>TIA,
>
>Nicole
>--
>
>Nicole Lallande
>[EMAIL PROTECTED]
>760.753.6766
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Stumped Newbie: Can't get results in db query even though everything checks - what am I missing?

2001-03-08 Thread Nicole Lallande

Greetings,

I keep getting the message that I cannot get results.  I have a simple
user authentication code that uses a mysql database to authenticate
from.  Initially I had the code working when I had the mysql_connect
variables in the code itself.  When I moved the connection variables to
an include file and then called them as variables, it was necessary to
change the variable names in the database (both were initially
$username, $password).  Now, while I have the connection and opening the
db correct I can't get results.  Here is my code:

require("connect.inc.php");

$connection = mysql_connect("$hostname","$username","$password") or die
("Unable to connect to database.");
echo "I'm connected.";
**__A-OK here

mysql_select_db("dnaUsers") or die ("Unable to select database.");
echo "I've opened the dnaUsers db.";
echo "$ruser, $rpass"; //this is from the html login form
**__Yup, no problem so far - 

// Formulate the query  
$sql = "SELECT rep_name FROM reps WHERE username='$ruser' and
password='$rpass'";
// Execute the query and put the results in $result
$result = mysql_query($sql,$connection) or die ("Couldn't get
results.");  

**__Here it is - crash and burn - the database name is correct, the
fields are correct, the username and password are in the db and have
been input correctly and are even being passed from the form correctly. 

I have checked the names of all the fields to ensure they match the
variables in the query, checked that the values in the fields are
correct -  (yes, I have checked that they match.) 

I have searched the archives but the hard thing about the archives is
formulating the question in a way that will yield an answer.  Sorry if
this has been asked before.

TIA,

Nicole


-- 

Nicole Lallande
[EMAIL PROTECTED]
760.753.6766


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Stumped Newbie: Can't get results in db query even though everything checks - what am I missing?

2001-03-08 Thread Nicole Lallande

Greetings,

I keep getting the message that I cannot get results.  I have a simple
user authentication code that uses a mysql database to authenticate
from.  Initially I had the code working when I had the mysql_connect
variables in the code itself.  When I moved the connection variables to
an include file and then called them as variables, it was necessary to
change the variable names in the database (both were initially
$username, $password).  Now, while I have the connection and opening the
db correct I can't get results.  Here is my code:

require("connect.inc.php");

$connection = mysql_connect("$hostname","$username","$password") or die
("Unable to connect to database.");
echo "I'm connected.";
**__A-OK here

mysql_select_db("dnaUsers") or die ("Unable to select database.");
echo "I've opened the dnaUsers db.";
echo "$ruser, $rpass"; //this is from the html login form
**__Yup, no problem so far - 

// Formulate the query  
$sql = "SELECT rep_name FROM reps WHERE username='$ruser' and
password='$rpass'";
// Execute the query and put the results in $result
$result = mysql_query($sql,$connection) or die ("Couldn't get
results.");  

**__Here it is - crash and burn - the database name is correct, the
fields are correct, the username and password are in the db and have
been input correctly and are even being passed from the form correctly. 

I have checked the names of all the fields to ensure they match the
variables in the query, checked that the values in the fields are
correct -  (yes, I have checked that they match.) 

I have searched the archives but the hard thing about the archives is
formulating the question in a way that will yield an answer.  Sorry if
this has been asked before.

TIA,

Nicole
-- 

Nicole Lallande
[EMAIL PROTECTED]
760.753.6766


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] stumped on mailing a complete page

2001-03-05 Thread Chris Adams

On 3 Mar 2001 17:17:15 -0800, Brett <[EMAIL PROTECTED]> wrote:
>I want to send a confirmation email upon receiving an order, and would like
>to send the page that I display on the browser to the user.

ob_start();

// do something

mail('confirm@somewhere', 'confirmation', ob_get_contents());
ob_end_flush();

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] stumped on mailing a complete page

2001-03-03 Thread Simon Garner

From: "Brett" <[EMAIL PROTECTED]>

> This question may have been asked a million times, but I have had no luck
> searching for a difinitive answer.
>
> I want to send a confirmation email upon receiving an order, and would
like
> to send the page that I display on the browser to the user.
>
> I can not figure out how to send a page, like the links that let you mail
a
> page to a friend on some sites.  Any help would be much appreciated.
>
> Thanks,
> Brett


If you want to email them the same page that you sent to the browser, you
can do this using output buffering. In your confirmation page:


";
?>

Thanks for your order!

";

// now mail the page
$mailto = "[EMAIL PROTECTED]";
$mailsubject = "Thanks for your order";
$mailbody = ob_get_contents();
$mailheaders = "From: [EMAIL PROTECTED]\nContent-Type: text/html";

mail($mailto, $mailsubject, $mailbody, $mailheaders);

// and output the page to the browser
ob_end_flush();
?>


But not all mail clients can read HTML email, so it is a good idea to
provide a plain text version of the email as well. You can put both versions
of the mail in the one message using MIME. Try changing the above code
slightly, as follows:





Have a flick through:
http://www.php.net/manual/en/ref.outcontrol.php
http://www.php.net/manual/en/function.mail.php



Cheers

Simon Garner


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] stumped on mailing a complete page

2001-03-03 Thread kevin1

use

$filearray = 
file("http://www.yourstite.com/yourscript.php?some_vars=whatever");

then

$body = join (" ",$filearray);

mail($to $subject,$body);

or something like that. Maybe readfile() may be of use here to. You just 
want to read the page in as a string, so make sure that you use some 
method of HTTP GET to grab the file - then you will have the html source 
seen by the browser. Put that into a string and mail it.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] stumped on mailing a complete page

2001-03-03 Thread Philip Murray

Hi,

This might help, its a script that'll suck in a page from your site and send
it as an HTML email.

Its NOWHERE near perfect, and needs alot of fixing. But it works. It relys
on HTML Mime Mail class from http://www.heyes-computing.net/scripts/. But I
had to make a few changes to the class to make it work in Windows clients.
You have to remove all the \r's and .chr(13)'s.

I hope this helps, I've attached the script I wrote

Cheers

Philip Murray
[EMAIL PROTECTED]


- Original Message -
From: "Brett" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: Sunday, March 04, 2001 2:22 PM
Subject: [PHP] stumped on mailing a complete page


> This question may have been asked a million times, but I have had no luck
> searching for a difinitive answer.
>
> I want to send a confirmation email upon receiving an order, and would
like
> to send the page that I display on the browser to the user.
>
> I can not figure out how to send a page, like the links that let you mail
a
> page to a friend on some sites.  Any help would be much appreciated.
>
> Thanks,
> Brett
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


Re: [PHP] stumped on mailing a complete page

2001-03-03 Thread Lewis Bergman

> This question may have been asked a million times, but I have had no
> luck searching for a difinitive answer.
> 
> I want to send a confirmation email upon receiving an order, and would
> like to send the page that I display on the browser to the user.
> 
> I can not figure out how to send a page, like the links that let you
> mail a page to a friend on some sites.  Any help would be much
> appreciated.
> 
> Thanks,
> Brett
Lets be clear. Do you want to send the page or just the important values 
from the page?

One way I do this is like this:
$successPage =<

[PHP] stumped on mailing a complete page

2001-03-03 Thread Brett

This question may have been asked a million times, but I have had no luck
searching for a difinitive answer.

I want to send a confirmation email upon receiving an order, and would like
to send the page that I display on the browser to the user.

I can not figure out how to send a page, like the links that let you mail a
page to a friend on some sites.  Any help would be much appreciated.

Thanks,
Brett


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]