Re: [PHP-DB] Checkboxes on repeat regions

2004-12-06 Thread Stuart Felenstein

--- Jason Wong [EMAIL PROTECTED] wrote:

 I'm not sure what you mean exactly by intended use
 checkboxes. 

Intended use - I generate a list (via a repeat region)
of records.  Each item on the list has an associated
checkbox. If I put a check in the box, do a $_POST I
expect on the next page where Ive set up the correct
parameters, to see the selected record only.


 How to implement using PHP:...again this stuff
is in the manual;

Probably, but then again all questions posted here
could be derived from the manual.
 

So I set the value of the check box to: 
th height=38 scope=rowinput type=checkbox
name=checkbox value=?php echo
$rsRes-Fields('Rese'); ?/th

(and by the way, that is Adoob syntax, so don't let
the value throw you)

While it returns from the correct field it is not
returning the correct record.  I read somewhere to
name checkbox as an array.  checkbox[]
Perhaps this is what I need to do. 

Stuart

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



Re: [PHP-DB] Checkboxes on repeat regions

2004-12-06 Thread Jason Wong
On Monday 06 December 2004 20:39, Stuart Felenstein wrote:

 --- Jason Wong [EMAIL PROTECTED] wrote:
  I'm not sure what you mean exactly by intended use
  checkboxes.

 Intended use - I generate a list (via a repeat region)
 of records.  Each item on the list has an associated
 checkbox. If I put a check in the box, do a $_POST I
 expect on the next page where Ive set up the correct
 parameters, to see the selected record only.

OK, so your intended use is to see the selected record(s?) (based on the 
checkboxes selected). Now your problem is not with the see selected record 
bit (I'm pretty sure you've got that sussed out), it is with how do I handle 
checkboxes. See below.

 Probably, but then again all questions posted here
 could be derived from the manual.

I would guess that 80% of the questions on the list could be answered with 
_direct_ reference to the manual(s). By direct reference I mean either 
searching the manual for the 1 or 2 _obvious_ keywords or looking in the 
_obvious_ section of the manual. For example, some people have asked how do 
I escape strings before inserting them into a mysql database, well one of 
the obvious place would be to look at the mysql section of the php manual, 
and if the asker had done that they would have seen that there are functions 
called mysql_real_escape_string() and mysql_escape_string(). That's why 
people should RTFM first, before even thinking of posting to the list!

Anyway ...

 So I set the value of the check box to:
 th height=38 scope=rowinput type=checkbox
 name=checkbox value=?php echo
 $rsRes-Fields('Rese'); ?/th

... there's your problem, all your checkboxes have the same name. PHP is not 
smart enough to automatically put them into an array, so if you check more 
than one checkbox PHP will either keep the first checkbox or the last 
checkbox (I don't know the exact behaviour (and don't care) but you can 
easily do some tests to find out should you wish).

 While it returns from the correct field it is not
 returning the correct record.  I read somewhere to
 name checkbox as an array.  checkbox[]
 Perhaps this is what I need to do.

Indeed, that is what the manual hints at, and what the articles will tell you 
to do.

-- 
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-db
--
/*
Okay ... I'm going home to write the I HATE RUBIK's CUBE HANDBOOK FOR
DEAD CAT LOVERS ...
*/

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



[PHP-DB] How to get 2 columns to display

2004-12-06 Thread Aaron Wolski
Hi guys,

I'm trying to get two columns of td/td to display side by side and
then go to a new row. I am using this code but nothing I seem to do is
working this far. 

?php
for ($r=0;$products = db_fetch($productsQuery);$r++)
{
?
  td align=centera href=?php echo $base_url; ?products/?php
echo $category; ?/?php echo $products['name_url']; ?
class=product_linkimg src=?php echo $base_url;
?product_images/thumbs/?php echo $products['thumb']; ? border=0
width=159br?php echo $products['name']; ?/a/td
?php
 if ((($r+1) % 2) == 0)
 {  
?
/tr
tr valign=top
?php
 }
}
?

What is happening with this code is I am getting results like:

tr
tdIMAGE HERE/td
tdIMAGE HERE/td
tdIMAGE HERE/td
tdIMAGE HERE/td
tdIMAGE HERE/td
/tr

What I WANT is:

tr
tdIMAGE HERE/td
tdIMAGE HERE/td
/tr
tdIMAGE HERE/td
tdIMAGE HERE/td
/tr
tdIMAGE HERE/td
td/td
/tr

ANY clue where I am going wrong?

Thanks so much.

Aaron

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



[PHP-DB] RE: Multi-User Update Problem

2004-12-06 Thread SCALES, Andrew
Thank you everyone who replied to my problem. I have decided now to go with
Anna's solution and so far it's working great!
So thank you very much for your help Anna.

Thanks again,
Andy.

-Original Message-
From: anna w [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 01 December 2004 11:17
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: Multi-User Update Problem


Hi Andy

Users will always leave browsers open with 'locked' records  go
home/to a meeting/ power down, so don't prevent access to locked
records.  In fact don't lock them unless you really have to.  Maybe
this would suit you better...

Add a timestamp to the relevant tables.  Add it to the primary key index.
Always retrieve the timestamp and write it to a hidden field in the
html update form.
When they click save:
Select the timestamp from the db based on the primary key (index
covered so should be fast).
If it matches the one sent from the form you're safe to do the update.
Else redisplay the form (fresh record from db including fresh
timestamp) with message Changes could not be saved as this record has
been updated since you displayed it.

If the message causes upset then start saving the name of who updated
the record along with the timestamp, and displaying it with the
message.  Then the users can blame each other instead of you, and
they'll quickly learn not to leave half-finished work when they go to
lunch ;)  Or if it's not a small community then display the time they
originally selected the record - you get the idea.

hth, hope it made sense!
Anna

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



RE: [PHP-DB] Mozilla inserts twice, IE does OK... ?

2004-12-06 Thread Bastien Koert
Post your relevant code and lets have a look.
bastien
From: Steven \[Offstage\] [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Mozilla inserts twice, IE does OK... ?
Date: Sun, 5 Dec 2004 23:41:43 +0100 (CET)
Hi there,
First post to this mailing list, and I have a very strange problem:
I'm using Apache2 with PHP 4.3.9 and MySQL 4.0.21.  Sometimes when I
execute an INSERT-query using mysql_query, the data is inserted twice.
I'm 150% sure the code is only executed once!  I tried this by adding
'echo test;'  right before and right after my mysql_query command.
The double insert happens only when surfing with Mozilla and Firefox.  In
Internet Explorer 6  the data is inserted only once (as should be).
I found some clues pointing in the direction of sessions, but after
commenting  out all other sections of the site and so eliminating all
other code, the problem was still there...
Has anyone any idea in what direction I have to look for a cause or
solution ?
Thanks in advance!
Steven
---
from Antwerp - Belgium
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] Mozilla inserts twice, IE does OK... ?

2004-12-06 Thread Norland, Martin
Are you using view source a lot?  (some of) Mozillas view source
commands send the query again, minus the POST vars.  This could be the
behaviour you're seeing.

I say some of because there are multiple ways of viewing the source -
web developer toolbar's (extension) doesn't seem to suffer from this
problem.  I'm a little cloudy on the specifics, it's a big muddled mess
:)

Cheers,
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


-Original Message-
From: Steven [Offstage] [mailto:[EMAIL PROTECTED] 
Sent: Sunday, December 05, 2004 4:42 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Mozilla inserts twice, IE does OK... ?


Hi there,

First post to this mailing list, and I have a very strange problem:

I'm using Apache2 with PHP 4.3.9 and MySQL 4.0.21.  Sometimes when I
execute an INSERT-query using mysql_query, the data is inserted twice.
I'm 150% sure the code is only executed once!  I tried this by adding
'echo test;'  right before and right after my mysql_query command.

The double insert happens only when surfing with Mozilla and Firefox.
In Internet Explorer 6  the data is inserted only once (as should be).

I found some clues pointing in the direction of sessions, but after
commenting  out all other sections of the site and so eliminating all
other code, the problem was still there...

Has anyone any idea in what direction I have to look for a cause or
solution ?

Thanks in advance!

Steven
---
from Antwerp - Belgium

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

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



Re: [PHP-DB] php5 and mysql_connect

2004-12-06 Thread Jason Wong
On Monday 06 December 2004 22:46, Norland, Martin wrote:

 No, PHP5 does indeed have some new (and different) functions for mysql,
 but it supports (properly, nothing old about it) the normal mysql
 functions as well.  The change for PHP5 is that it no longer enables
 mysql functions by default (you need to now compile it with
 --with-mysql), and it no longer bundles the client libraries.

AFAIK no version of PHP ever did compile with mysql by default. You *had* to 
use --with-mysql if you wanted mysql support. The choice was whether to use 
the bundled library (the default if you didn't specify a directory with 
--with-mysql) or some other library.

 From http://www.faqts.com/knowledge_base/view.phtml/aid/22154

   - MySQL support.  There has been some confusion with regards to the
 disabling of MySQL by default in PHP 5.  This simply means that in
 order to use MySQL you must explictly use --with-mysql just like
 you do with most every other extension. 

If this is where you got the above from, then maybe you would like to point 
out to them that it is incorrect (not that it matters to people using PHP5 -- 
but people using PHP4 might wonder why they don't have mysql support when it 
is supposed to be enabled by default).

Actually, reading it again, it doesn't explicitly say the versions of PHP 
older than PHP5 enabled by mysql by default. Maybe it is your interpretation 
and reading between the lines which led to your above statement :)

-- 
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-db
--
/*
ultima netgod: My calculator has more registers than the x86, and
 -thats- sad
*/

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



RE: [PHP-DB] php5 and mysql_connect

2004-12-06 Thread Norland, Martin
 anyway mysql_connect() won't work in php5 - although I do believe it's

 possible to compile in the 'old' mysql lib yourself.

No, PHP5 does indeed have some new (and different) functions for mysql,
but it supports (properly, nothing old about it) the normal mysql
functions as well.  The change for PHP5 is that it no longer enables
mysql functions by default (you need to now compile it with
--with-mysql), and it no longer bundles the client libraries. 

From http://www.faqts.com/knowledge_base/view.phtml/aid/22154

  - MySQL support.  There has been some confusion with regards to the
disabling of MySQL by default in PHP 5.  This simply means that in
order to use MySQL you must explictly use --with-mysql just like
you do with most every other extension.  Also, the client libraries
are no longer bundled, this means you must use your MySQL sources 
instead of optionally using the version that comes with PHP 4.

People can still use --with-mysql[=DIR], this move isn't a big deal.

The reason for this action is three-fold:
  - MySQL 3 (which is bundled in PHP 4) : This bundled library
was no longer properly maintained.
  - MySQL 4 (never bundled) : Is GPL, so doesn't fit with the PHP 
license.
  - PHP is attempting to bundle less third party libraries.
  - Also listed in the following faq:
http://php.net/manual/faq.databases.php#faq.databases.mysql.php5

( That link doesn't work for me, without some help:
http://us2.php.net/manual/en/faq.databases.php#faq.databases.mysql.php5
)

  I have to admit to not understanding exactly why mysqli functions
would be available when mysql functions aren't - seems fundamentally
wrong, unless they're somehow using a library that the php developers
themselves are actively maintaining, or someone else is maintaining and
releasing under a compatible license.  Given their statement is they're
trying to bundle fewer third party libraries, that's all I can see.

The new functions for mysql are meant to be used with mysql 4.1.3+ only,
and they have some neat new things like bind variables.  I can't speak
as to whether one would gain performance from using mysqli_query over
mysql_query (though I would hope one wouldn't lose it!).

Cheers,
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.

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



RE: [PHP-DB] How to get 2 columns to display

2004-12-06 Thread Bastien Koert
try this
?php
for ($r=0;$products = db_fetch($productsQuery);$r++)
{
if (($r % 2) == 0)
 {
echo /tr
tr valign=\top\;
 }
 echo td align=\center\
 			a href=.$base_url.products/.$category./.$products['name_url']
		class=product_linkimg 
src=.$base_url.product_images/thumbs/.$products['thumb'] border=0
		width=\159\br.$products['name']./a/td;

}
?

bastien

From: Aaron Wolski [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] How to get 2 columns to display
Date: Mon, 6 Dec 2004 08:43:21 -0500
Hi guys,
I'm trying to get two columns of td/td to display side by side and
then go to a new row. I am using this code but nothing I seem to do is
working this far.
?php
for ($r=0;$products = db_fetch($productsQuery);$r++)
{
?
  td align=centera href=?php echo $base_url; ?products/?php
echo $category; ?/?php echo $products['name_url']; ?
class=product_linkimg src=?php echo $base_url;
?product_images/thumbs/?php echo $products['thumb']; ? border=0
width=159br?php echo $products['name']; ?/a/td
?php
 if ((($r+1) % 2) == 0)
 {
?
/tr
tr valign=top
?php
 }
}
?
What is happening with this code is I am getting results like:
tr
tdIMAGE HERE/td
tdIMAGE HERE/td
tdIMAGE HERE/td
tdIMAGE HERE/td
tdIMAGE HERE/td
/tr
What I WANT is:
tr
tdIMAGE HERE/td
tdIMAGE HERE/td
/tr
tdIMAGE HERE/td
tdIMAGE HERE/td
/tr
tdIMAGE HERE/td
td/td
/tr
ANY clue where I am going wrong?
Thanks so much.
Aaron
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] pagination

2004-12-06 Thread Bastien Koert
Newer versions of php user $_POST and $_GET to access form variables...try 
this

if([EMAIL PROTECTED]'start']) $start = 0;
bastien
From: Valerie [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] pagination
Date: Sun, 5 Dec 2004 10:19:03 -0500
It shows next and the first 10 records but will not bring up the next 10
when next is pressed.
?php
require ('db_params.inc');
if(!$start) $start = 0;
$query2 = 'SELECT count(*) as count '
. ' FROM `Wellington` '
. ' WHERE`location`=Hills';
$result2 = mysql_query($query2);
$row2 = mysql_fetch_array($result2);
$

numrows = $row2['count'];
if($start  1){
   echo a href=\ . $_SERVER['PHP_SELF']. ?start= . ($start- 10) .
\Previous/aBR;
}
if($numrows  ($start + 10)){
   echo a href=\ . $_SERVER['PHP_SELF']. ?start= . ($start + 10) .
   \Next/aBR;
}
$query='SELECT * '
. ' FROM `Wellington` '
. ' WHERE`location`=Hills ORDER BY `LotNo` ASC LIMIT ' .
$start. ',10';
$result=mysql_query($query);
while ($row = mysql_fetch_assoc($result)) {
$location=$row['Location'];
$ln=$row['LotNo'];
$price=$row['Price'];
 $listing=html
 head
 /head
 body
 table align='center'
  tr
td$ln/td
   td $location/td
   td$price/td
  /tr/table
  /body/html;
   echo $listing;
}
?
- Original Message -

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


RE: [PHP-DB] php5 and mysql_connect

2004-12-06 Thread Norland, Martin
 AFAIK no version of PHP ever did compile with mysql by default. You
*had* to 
 use --with-mysql if you wanted mysql support. The choice was whether
to use 
 the bundled library (the default if you didn't specify a directory
with 
 --with-mysql) or some other library.
snip
 If this is where you got the above from, then maybe you would like to
point 
 out to them that it is incorrect (not that it matters to people using
PHP5 -- 
 but people using PHP4 might wonder why they don't have mysql support
when it 
 is supposed to be enabled by default).
snip
 Actually, reading it again, it doesn't explicitly say the versions of
PHP 
 older than PHP5 enabled by mysql by default. Maybe it is your
interpretation 
 and reading between the lines which led to your above statement :)

I'd like to point out to them that it's my intepretation that's
incorrect.  Only thing is, shucks - it's not.  Oh well, can't please all
of the people all of the time.

http://us2.php.net/manual/en/ref.mysql.php

 In PHP 4, the option --with-mysql is enabled by default. To disable
this default behavior, you may use the --without-mysql configure option.
Also in PHP 4, if you enable MySQL without specifying the path to the
MySQL install DIR, PHP will use the bundled MySQL client libraries.

I suppose we could say that it may not have been the default in PHP 3 -
but since that was released in '98, that might be pushing it a bit.  I
can't quickly find any mention of mysql and php3 on php's site - as it
relates to builtin support - but my skills in finding information there
may not be as honed as yours.

Sorry this got a little toasty, but it sure felt like a blind attack,
since the most cursory of checks revealed my statements true.

Cheers,
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] php5 and mysql_connect

2004-12-06 Thread Jason Wong
On Monday 06 December 2004 23:54, Norland, Martin wrote:

 Sorry this got a little toasty, but it sure felt like a blind attack,
 since the most cursory of checks revealed my statements true.

I'm sorry if you felt that that was an attack. Your honour, in my defence, I 
confess that I haven't really read the Installation section of the MySQL 
functions chapter of the manual since sometime near the end of the PHP 3 
development cycle. And I've always relied on ./configure --help to show me 
what the defaults are for the particular version of PHP I'm installing. In 
light of the mitigating circumstances I declare this a mistrial :)

-- 
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-db
--
/*
BOFH Excuse #346:

Your/our computer(s) had suffered a memory leak, and we are waiting for them 
to be topped up.
*/

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



[PHP-DB] stumped-mail and database

2004-12-06 Thread Stuart Felenstein
I'm trying to send mail out based partially on a
recordset/binding.

The fields are available but I'm not sure if they need
to be turned into a variable first or if I can just
reference them in the body of the email.

Here is what I tried:

$to = $rsVendorJobs-Fields('Conmail');
$subject = $rsVendorJobs-Fields('RefEm');
$body = '$cl';
$headers = From: [EMAIL PROTECTED];
mail($to,$subject,$body,$headers);
echo Mail sent to $to;
}
K...so you know this didn't work.  I'm googling around
but haven't come up with anything on this subject. 
Appreciate some pointers please. 

Stuart

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



RE: [PHP-DB] stumped-mail and database

2004-12-06 Thread Bastien Koert
I prefer to assign the db values to loca variables to ensure that I am 
sending out exactly what I need to.

Bastien
From: Stuart Felenstein [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] stumped-mail and database
Date: Mon, 6 Dec 2004 10:05:57 -0800 (PST)
I'm trying to send mail out based partially on a
recordset/binding.
The fields are available but I'm not sure if they need
to be turned into a variable first or if I can just
reference them in the body of the email.
Here is what I tried:
$to = $rsVendorJobs-Fields('Conmail');
$subject = $rsVendorJobs-Fields('RefEm');
$body = '$cl';
$headers = From: [EMAIL PROTECTED];
mail($to,$subject,$body,$headers);
echo Mail sent to $to;
}
K...so you know this didn't work.  I'm googling around
but haven't come up with anything on this subject.
Appreciate some pointers please.
Stuart
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] stumped-mail and database

2004-12-06 Thread Norland, Martin
-Original Message-
From: Stuart Felenstein [mailto:[EMAIL PROTECTED] 
 Here is what I tried:
 
 $to = $rsVendorJobs-Fields('Conmail');
 $subject = $rsVendorJobs-Fields('RefEm');
 $body = '$cl';
 $headers = From: [EMAIL PROTECTED];
mail($to,$subject,$body,$headers);
 echo Mail sent to $to;
 }

1) change
$to = $rsVendorJobs-Fields('Conmail');
To
$to = {$rsVendorJobs-Fields('Conmail')};
Or just
$to = $rsVendorJobs-Fields('Conmail');

2) change 
$body = '$cl';
To
$body = $cl;

3) from mail() docs
[this is just for reference, since you're only sending one header it's
probably not a problem]
Note:  You must use \r\n to separate headers, although some Unix mail
transfer agents may work with just a single newline (\n).

Then we'll see where you are from there...

Cheers,
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] stumped-mail and database

2004-12-06 Thread Jochem Maas
er, I don't know if it would interest you but here is a class I have 
been using for ages now (not that I have trouble using mail() for simple 
jobs) because its simple, packed with functionality and works well:

http://phpmailer.sourceforge.net/
the following page hopefully demonstrates how simple it is to setup/use:
http://phpmailer.sourceforge.net/extending.html
Norland, Martin wrote:
-Original Message-
...
1) change
$to = $rsVendorJobs-Fields('Conmail');
I suspect that $to would contain something like:
(Object) -Fields('Conmail')
or something even more garbage like (i.e. ),
'complex' $variables in doubled quotes strings should always
be wrapped in curly braces, if only for clarities sake
(if you want to know exactly when they are required then RTFM ;-).
To
$to = {$rsVendorJobs-Fields('Conmail')};
Or just
$to = $rsVendorJobs-Fields('Conmail');
this is the best way - saves some string interpolation.
2) change 
$body = '$cl';
	To
$body = $cl;

3) from mail() docs
[this is just for reference, since you're only sending one header it's
probably not a problem]
Note:  You must use \r\n to separate headers, although some Unix mail
transfer agents may work with just a single newline (\n).
Then we'll see where you are from there...
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] stumped-mail and database

2004-12-06 Thread Stuart Felenstein

--- Bastien Koert [EMAIL PROTECTED] wrote:

 I prefer to assign the db values to loca variables
 to ensure that I am 
 sending out exactly what I need to.
 


Well the binding is one where clause that pulls the
correct record for the transaction.  Following what
you are saying, how does that actually look ?
Maybe something like this 

$myvar = select field from table where id = 2 ?

Something as simple as that perhaps ?

Stuart

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



RE: [PHP-DB] stumped-mail and database

2004-12-06 Thread Stuart Felenstein

--- Norland, Martin [EMAIL PROTECTED]
wrote:


 1) change
 $to = $rsVendorJobs-Fields('Conmail');
   To
 $to = {$rsVendorJobs-Fields('Conmail')};
   Or just
 $to = $rsVendorJobs-Fields('Conmail');
 
 2) change 
 $body = '$cl';
   To
 $body = $cl;
 

Well I'm sure this is not the syntax, but since I've
written it both ways I get a :

Fatal error: Call to a member function on a non-object
in /home/xxx/public_html/appjobb.php on line 39

Which I'm guessing means it is written correctly but
now the variable doesn't exist ?

Stuart

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



RE: [PHP-DB] stumped-mail and database

2004-12-06 Thread Norland, Martin
What is $rsVendorJobs, where is it populated?  I assumed, from the way
you were using it - that it was a class object with a 'fields' function
that returns the value of a column when passed the column name.  Which,
looking back, seems pretty excessively  abstracted :)

Is $rsVendorJobs just the result of a mysql_query()? If so, you probably
just want to be using:

$to = $rsVendorJobs['Conmail'];

Also note - the case sensitivity may or may not be a problem (you may
need to use 'conmail')
Otherwise, let's see some code to flesh this out!

Cheers,
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


-Original Message-
From: Stuart Felenstein [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 06, 2004 1:37 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] stumped-mail and database



--- Norland, Martin [EMAIL PROTECTED]
wrote:


 1) change
 $to = $rsVendorJobs-Fields('Conmail');
   To
 $to = {$rsVendorJobs-Fields('Conmail')};
   Or just
 $to = $rsVendorJobs-Fields('Conmail');
 
 2) change
 $body = '$cl';
   To
 $body = $cl;
 

Well I'm sure this is not the syntax, but since I've
written it both ways I get a :

Fatal error: Call to a member function on a non-object
in /home/xxx/public_html/appjobb.php on line 39

Which I'm guessing means it is written correctly but
now the variable doesn't exist ?

Stuart

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

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



RE: [PHP-DB] stumped-mail and database

2004-12-06 Thread Stuart Felenstein

--- Norland, Martin [EMAIL PROTECTED]
wrote:

 What is $rsVendorJobs

It's a recordset which for lack of a better
definition is a sql query.
 
 Is $rsVendorJobs just the result of a mysql_query()?
 If so, you probably
 just want to be using:
 
 $to = $rsVendorJobs['Conmail'];

Nope, though it didn't throw an error, it was blank.
Here is the code. There is actually a transaction that
takes place (insert into database) the email is set up
as an after trigger to the  insert.  I'm leaving the
transaction out. 
 
$query_rsVendorJobs = sprintf(SELECT   
`VendorJobs`.`Contact`,   `VendorJobs`.`Conmail`,  
CONCAT_WS('-', `VendorJobs`.`JobID`,
`VendorJobDetails`.`OptRefCode`,
`VendorJobs`.`JobTitle`) AS `RefEm`,  
`VendorSignUp`.`CompanyName`,   `VendorJobs`.`JobID`, 
 `VendorJobs`.`JobTitle`,  
`VendorJobDetails`.`OptRefCode` FROM   `VendorJobs`  
INNER JOIN `VendorJobDetails` ON (`VendorJobs`.`JobID`
= `VendorJobDetails`.`JobID`)   INNER JOIN
`VendorSignUp` ON (`VendorJobs`.`VendorID` =
`VendorSignUp`.`VendorID`) WHERE   (VendorJobs.JobID =
%s) , $colname__rsVendorJobs);
$rsVendorJobs =
$-SelectLimit($query_rsVendorJobs) or
die($-ErrorMsg());
$totalRows_rsVendorJobs =
$rsVendorJobs-RecordCount();
// end Recordset


%s = the JobID I've selected on the previous page and
passed over with $_POST

Hope this is enough.  Not sure what else to send.

Stuart

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



RE: [PHP-DB] stumped-mail and database

2004-12-06 Thread Norland, Martin
All I can recommend from here is heavy use of printr() or var_dump() on
your variables.

 $totalRows_rsVendorJobs = $rsVendorJobs-RecordCount(); // end
Recordset

This clearly means $rsVendorJobs is an object of some sort, probably
some custom recordset object as you've said - so your best bet is to
var_dump it and look through the information you're presented with, to
try and track down what's going wrong or where your data is.

Obviously, also, you'll want to print out the query you're using to make
sure it's actually correct sql/being populated/etc.  Perhaps even run a
var_dump($-SelectLimit($query_rsVendorJobs)) to see just what
result you're getting back, although from your code it should exactly
match a dump of $rsVendorJobs.

Good luck, happy hunting
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] stumped-mail and database

2004-12-06 Thread Stuart Felenstein

--- Norland, Martin [EMAIL PROTECTED]
wrote:

 All I can recommend from here is heavy use of
 printr() or var_dump() on
 your variables.
 
They are NULL.  That is the problem.  I can't for the
life of me , figure out a way to initialize these
variables.
 
 Obviously, also, you'll want to print out the query
 you're using to make
 sure it's actually correct sql/being populated/etc. 
 Perhaps even run a
 var_dump($-SelectLimit($query_rsVendorJobs)) to
 see just what
 result you're getting back, although from your code
 it should exactly
 match a dump of $rsVendorJobs.
 
Yeah , the sql is cool  Everything returns as
expected.

Stuart

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



RE: [PHP-DB] stumped-mail and database

2004-12-06 Thread Norland, Martin
-Original Message-
From: Stuart Felenstein [mailto:[EMAIL PROTECTED] 
 They are NULL.  That is the problem.  I can't for the life of me ,
figure out a way to
 initialize these variables.

(Bear with me on this, because I've got nothing remaining to go on...)
What do you get from:

var_dump($query_rsVendorJobs);
var_dump($totalRows_rsVendorJobs);
var_dump($-SelectLimit($query_rsVendorJobs));
var_dump($rsVendorJobs); // should match above.
// If this one is huge - we may want to hold off on this one
var_dump($);

Place all of those at the bottom of the script, and I suggest enclosing
them within pre tags, for legibility. (print_r is a slightly more
legible option, but var_dump gives us more information).

- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] stumped-mail and database

2004-12-06 Thread Jochem Maas
Stuart Felenstein wrote:
--- Norland, Martin [EMAIL PROTECTED]
wrote:

All I can recommend from here is heavy use of
printr() or var_dump() on
your variables.
They are NULL.  That is the problem.  I can't for the
life of me , figure out a way to initialize these
variables.
be more specific - its not at all clear which variables are null?
is your 'recordset' ($rsVendorJobs) actually an object?
if not you have to go into the $-SelectLimit($query_rsVendorJobs) 
call to find out what is going wrong.

Is this the first time you are attempting to use the DB abstraction
objects/classes that your code snippets hint at? if so,
specify exactly what it is, it may help.
also have you checked your error logs?
 

Obviously, also, you'll want to print out the query
you're using to make
sure it's actually correct sql/being populated/etc. 
Perhaps even run a
var_dump($-SelectLimit($query_rsVendorJobs)) to
see just what
result you're getting back, although from your code
it should exactly
match a dump of $rsVendorJobs.

Yeah , the sql is cool  Everything returns as
expected.
Stuart
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] stumped-mail and database

2004-12-06 Thread Stuart Felenstein
--- Norland, Martin [EMAIL PROTECTED]
wrote:
 (Bear with me on this, because I've got nothing
 remaining to go on...)
 What do you get from:
 
   var_dump($query_rsVendorJobs);
   var_dump($totalRows_rsVendorJobs);
   var_dump($-SelectLimit($query_rsVendorJobs));
   var_dump($rsVendorJobs); // should match above.
   // If this one is huge - we may want to hold off on
 this one
   var_dump($);
 
I held off on the vary_dump($);

The most revealing were:

var_dump($query_rsVendorJobs);
This is just basically the sql statement:

string(513) SELECT `VendorJobs`.`Contact`,
`VendorJobs`.`Conmail`, CONCAT_WS('-',
`VendorJobs`.`JobID`, `VendorJobDetails`.`OptRefCode`,
`VendorJobs`.`JobTitle`) AS `RefEm`,
`VendorSignUp`.`CompanyName`, `VendorJobs`.`JobID`,
`VendorJobs`.`JobTitle`,
`VendorJobDetails`.`OptRefCode` FROM `VendorJobs`
INNER JOIN `VendorJobDetails` ON (`VendorJobs`.`JobID`
= `VendorJobDetails`.`JobID`) INNER JOIN
`VendorSignUp` ON (`VendorJobs`.`VendorID` =
`VendorSignUp`.`VendorID`) WHERE (VendorJobs.JobID =
10042) 

Yet the JobID is correct so that's a positive

The other var_dump is:

var_dump($rsVendorJobs);

this returned alot.  I snipped most of it but if you
look , well if I look, all the fields have the correct
values:

object(kt_adorecordset_mysql)(33) { [dataProvider]=
string(6) native [fields]= array(14) { [0]=
string(12) Hamas Zwicki [Contact]= string(12)
Hamas Zwicki [1]= string(18) [EMAIL PROTECTED]
[Conmail]= string(18) [EMAIL PROTECTED] [2]=
string(24) 10042-A99839-Entry Clerk [RefEm]=
string(24) 10042-A99839-Entry Clerk [3]= string(13)
Talman Zwicki [CompanyName]= string(13) Talman
Zwicki [4]= string(5) 10042 [JobID]= string(5)
10042 [5]= string(11) Entry Clerk [JobTitle]=
string(11) Entry Clerk [6]= string(6) A99839
[OptRefCode]= string(6) A99839 } [blobSize]=
int(100) [canSeek]= bool(true) [sql]=
string(540) SELECT `VendorJobs`.`Contact`,
`VendorJobs`.`Conmail`, CONCAT_WS('-',
`VendorJobs`.`JobID`, `VendorJobDetails`.`OptRefCode`,
`VendorJobs`.`JobTitle`) AS `RefEm`,
`VendorSignUp`.`CompanyName`, `VendorJobs`.`JobID`,
`VendorJobs`.`JobTitle`,
`VendorJobDetails`.`OptRefCode` FROM `VendorJobs`
INNER JOIN `VendorJobDetails` ON ...[snip]

Stuart

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



RE: [PHP-DB] stumped-mail and database

2004-12-06 Thread Norland, Martin
 var_dump($rsVendorJobs);
 
 object(kt_adorecordset_mysql)(33) { [dataProvider]=

Looks like you're using the ADODB library (
http://www.certicamara.com/consulta/lib/adodb/docs-adodb.htm ) or
similar.  ( That may not be the official site, I just bounced around a
bit. )

All your previous code looks to have been correct, so I'm not really
sure where to go from here.  You may want to look into $ADODB_FETCH_MODE
and see if you can't just get an associative array with your fields
directly out, instead of pulling each little piece out through the
convenience function Fields() (which... doesn't seem to be working).

Not best practice - in fact, extremely BAD practice, but you should be
able to access it with $rsVendorJobs-fields['fieldname'].  Note, of
course, that that's internal structure of their object - and you should
NOT be directly accessing such things.  Still, it will help you check if
you're sane.

I really REALLY don't recommend directly digging into a black box like
this unless you know it will never change, or have some good
documentation area where people will know to look before upgrading.

- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] stumped-mail and database

2004-12-06 Thread Jochem Maas
I just thought, if your query object ($) is returning a
resultset object then maybe you have to 'loop' the resultset object
in order to retrieve the 'row' object(s) from which you can retrieve the 
data.

your resultset object doesn't have a GetRowAssoc() method?
[ defined as GetRowAssoc($upper=true) ]
Norland, Martin wrote:
var_dump($rsVendorJobs);
object(kt_adorecordset_mysql)(33) { [dataProvider]=

Looks like you're using the ADODB library (
http://www.certicamara.com/consulta/lib/adodb/docs-adodb.htm ) or
similar.  ( That may not be the official site, I just bounced around a
bit. )
All your previous code looks to have been correct, so I'm not really
sure where to go from here.  You may want to look into $ADODB_FETCH_MODE
and see if you can't just get an associative array with your fields
directly out, instead of pulling each little piece out through the
convenience function Fields() (which... doesn't seem to be working).
Not best practice - in fact, extremely BAD practice, but you should be
able to access it with $rsVendorJobs-fields['fieldname'].  Note, of
course, that that's internal structure of their object - and you should
NOT be directly accessing such things.  Still, it will help you check if
you're sane.
I really REALLY don't recommend directly digging into a black box like
this unless you know it will never change, or have some good
documentation area where people will know to look before upgrading.
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.

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