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



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

?php
// Code before
if(!$dbEnd = (mysql_query($getEnd, $dbc))){
   echo mysql_error() . \n;
   exit();
}
//  code after
?

You're merging assignment.  Maybe you meant this:

?php
if(($dbEnd = mysql_query($getEnd, $dbc)) === FALSE) {
echo mysql_error() . \n;
exit();
}
?

Or you could do it like I do:

?php
$dbEnd = mysql_query($getEnd,$dbc) or die(mysql_error());
?

-- 
/Daniel P. Brown
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

?php
// Code before
if(!$dbEnd = (mysql_query($getEnd, $dbc))){
   echo mysql_error() . \n;
   exit();
}
//  code after
?

You're merging assignment.  Maybe you meant this:

?php
if(($dbEnd = mysql_query($getEnd, $dbc)) === FALSE) {
echo mysql_error() . \n;
exit();
}
?
[/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 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?

-- 
/Daniel P. Brown
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 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.

-- 
/Daniel P. Brown
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 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 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 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.

-- 
/Daniel P. Brown
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: 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



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

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



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



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 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{
echobrProcess anomaly. Please try again.br;
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



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:

  ?php
echo {$_POST['foo']};
  ?

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



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

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




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\)
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
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\)
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
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, 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

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

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

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.

 ?php
 $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 (a href=\edit.php?id='$id'\$meetingName/aP);
 ?

---John Holmes...


-- 
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 (a
href=\edit.php?id='$id'\$meetingName/aP);

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 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 (a
 href=\edit.php?id='$id'\$meetingName/aP);
 
 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-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 ?php ?
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




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




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




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=lhttp://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 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.br";
**__A-OK here

mysql_select_db("dnaUsers") or die ("Unable to select database.");
echo "I've opened the dnaUsers db.br";
echo "$ruser, $rpassbr"; //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]




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.br";
 **__A-OK here
 
 mysql_select_db("dnaUsers") or die ("Unable to select database.");
 echo "I've opened the dnaUsers db.br";
 echo "$ruser, $rpassbr"; //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 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 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 =EOF
centerh1SUCCESS!!/h1/center
lots of 
stuff
here.
A whole html page.
EOF

then you mail it like this
   mail('order.money.com', $headers, $successPage);

or you just loop through all the post vars and build a body from that 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 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 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:


?php
ob_start(); // turn on output buffering
echo "html";
?

Thanks for your order!

?php
echo "/html";

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


?php
...

$mailbody = END
This is a multi-part message in MIME format.

--=_NextPart_
Content-Type: text/plain

(Here goes the plain-text version of the email.)
Dear Customer,

Thanks for your order.

--=_NextPart_
Content-Type: text/html

END;
$mailbody .= ob_get_contents(); // inserts the HTML version
$mailbody .= "\n\n--=_NextPart_";

$mailheaders = "From: [EMAIL PROTECTED]\n"
. "MIME-Version: 1.0\n"
. "Content-Type: multipart/alternative;\n"
. " boundary=\"=_NextPart_\"";

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

...
?


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]