[PHP-DB] Mail Function

2004-01-30 Thread Graeme McLaren
Evening all, I've written a script which sends emails, there is no problem
with that.  I was wondering how I can check for email bounces, anyone know
how to do that?

Cheers,

G :)

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



[PHP-DB] test post

2004-01-30 Thread Graeme McLaren
please delete this

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



[PHP-DB] Query works but can't echo variable :'(

2003-10-26 Thread Graeme McLaren
Hey everyone, the following query and code works fine but I can't understand
why I can't echo the $Date variable.  I guess it doesn't work fine then :(

Any ideas ?

G :)

$TheDate = mysql_query(select DATE_FORMAT(DateOfOrder, '%d, %m, %Y') as
date from Orders Where Orders.ID = '$TransID');

while($OrderDate = mysql_fetch_array($TheDate))

{

$Date = $OrderDate[DateOfOrder];

}

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



[PHP-DB] Replacing + with question

2003-09-30 Thread Graeme McLaren
Hi all I want the contents of a variable to be returned to the user without
the + symbols, how do I do that?

This is what I have so far by the string replace function doesn't replace
the spaces and display bla bla bla as I want:

$AddressLine1 = urlencode($AddressLine1);
$AddressLine1 = str_replace( , +, $AddressLine1);
echo First Line Of Address: BR input type=text Name=AddressLine1
value=$AddressLine1BRBR;



Cheers,

Graeme :)

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



Re: [PHP-DB] Replacing + with question

2003-09-30 Thread Graeme McLaren
Jason, thank you for reply.  I tried switching the 1st 2 parameters in the
str_replace function so that it now looks like this:

$AddressLine1 = urlencode($AddressLine1);

$AddressLine1 = str_replace(+,  , $AddressLine1);



Unfortunately as I am now replacing the + symbols with a space   only the
part up to the first space is displayed back to the user.

Any ideas?

Cheers again,

Graeme :)

- Original Message - 
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, September 30, 2003 7:12 PM
Subject: Re: [PHP-DB] Replacing + with   question


 On Wednesday 01 October 2003 01:06, Graeme McLaren wrote:

  This is what I have so far by the string replace function doesn't
replace
  the spaces and display bla bla bla as I want:

 Probably it's because you're trying to replace spaces with +. Swap your
first
 2 parameters.

  $AddressLine1 = urlencode($AddressLine1);
  $AddressLine1 = str_replace( , +, $AddressLine1);

 -- 
 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
 --
 /*
 Surprise your boss.  Get to work on time.
 */

 -- 
 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] basic php question

2003-09-03 Thread Graeme McLaren
Darryl, I'm not completely clear on what you mean by I need to walk table
employee and see if emp2 has a record that matches by employee number

From what I understand I would do something like:

$query = mysql_query(select * from employee where EmployeeNo = $EmployeeNo
and emp2.EmployeeNo = '$EmployeeNo');

if(mysql_num_rows($query) == 1)
{
mysql_query(update emp2 where emp2.id = '$SomeValue');
}

else
{
mysql_query(insert into emp2 set X = '$X');
}


hope this helps,

Graeme :)

- Original Message - 
From: Darryl [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, September 03, 2003 10:14 PM
Subject: [PHP-DB] basic php question


 Greetings,
 I have php and mysql installed on my freebsd machine.
 I have a database iweb with tables employee and emp2.
 
 I need to walk table employee and see if emp2 has a
 record that matches by employee number.  If it matches,
 I need to update some values in emp2.  If there is no match,
 I need to create a new record in emp2 and load values.
 
 Is there a tutorial that shows how to do something this basic ?
 tips ?
 
 thanks,
 Darryl
 
 -- 
 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] mysql_fetch_array() question

2002-11-06 Thread Graeme McLaren
Josh, Thank you for reply.  Thank you to everyone else who replied to my
email also.  I solved the problem shortly after posting my question, I've
now got a massive SQL query which does the trick.

I was interested when you replied and part of it read:  Just
remember that you can only work with one mysql result per connection at
a time.  Can you explain a little more about that please?  I don't think I
fully understand what you mean.

Cheers,

Graeme :)

- Original Message -
From: Josh Johnson [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, November 06, 2002 12:29 PM
Subject: RE: [PHP-DB] mysql_fetch_array() question


 I concur with Jason, but if restructuring is out of the question, just
 rearrange your queries like this:

 $query = SELECT Name, Address FROM users;
 $result = mysql_query($query);
 while($details = mysql_fetch_array($result)){
 echo Name: $details[Name];
 echo Address: $details[Address];
 }
 $query2 = SELECT EmailAddress From Members;
 $result2 = mysql_query($query2);
 while($details = mysql_fetch_array($result2)){
 echo Email: $Email[EmailAddress];
 }

 The results won't come out at the same time, but you could use some
 logic to combine the results into an array by a common factor. Just
 remember that you can only work with one mysql result per connection at
 a time. You *may* (untested!) be able to accomplish what you want to do
 with two separate connections, but again, this is seriously overkill. :)

 I'd definitely recommend restructuring your talbes as Jason suggested.
 -- Josh


 -Original Message-
 From: Jason Wong [mailto:phplist;gremlins.com.hk]
 Sent: Wednesday, November 06, 2002 5:24 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] mysql_fetch_array() question

 On Tuesday 05 November 2002 05:47, Graeme McLaren wrote:
  Hi, Anyone know how I can use two mysql_fetch_array() functions
 similar
  to the code below?  I've tried a few different ways but I keep getting
  Resource ID #4.  I need to do this to retrieve an email address from
 one
  table and retrieve details from another.
 
  Cheers for any tips - I'm stumped with this one,
 
  Graeme :)
 
  $query = SELECT Name, Address FROM users;
  $query2 = SELECT EmailAddress From Members;
 
  $result = mysql_query($query);
  $result2 = mysql_query($query2);
 
  while($details = mysql_fetch_array($result) and $Email =
  mysql_fetch_array($result2))
  {
  echo Name: $details[Name];
  echo Address: $details[Address];
  echo Email: $Email[EmailAddress];
  }

 Unless I've missed something you're going about this the wrong way. For
 what
 you want to do, you should (in general) be able to accomplish it using
 just a
 single query.

 What fields do the tables 'users' and 'Members' contain? There should be
 a
 field there (like eg. userid) which links the two together. If there
 isn't
 one then you should seriously restructure your tables so that there is
 one.

 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *


 /*
 Cats are smarter than dogs.  You can't make eight cats pull a sled
 through
 the snow.
 */


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



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




[PHP-DB] Re: mysql_fetch_array() question

2002-11-04 Thread Graeme McLaren
Hi everyone, I think I've got the problem sorted, I'll soon let y'all
know if it doesn't work ! 

Cheers,

Graeme :)

On Mon, 2002-11-04 at 21:47, Graeme McLaren wrote:
 Hi, Anyone know how I can use two mysql_fetch_array() functions similar
 to the code below?  I've tried a few different ways but I keep getting
 Resource ID #4.  I need to do this to retrieve an email address from one
 table and retrieve details from another.
 
 Cheers for any tips - I'm stumped with this one,
 
 Graeme :)
 
 $query = SELECT Name, Address FROM users; 
 $query2 = SELECT EmailAddress From Members;
 
 $result = mysql_query($query);
 $result2 = mysql_query($query2);
 
 while($details = mysql_fetch_array($result) and $Email =
 mysql_fetch_array($result2))
 {
 echo Name: $details[Name];
 echo Address: $details[Address];
 echo Email: $Email[EmailAddress];
 }
 
 
 
 



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




[PHP-DB] mysql_fetch_array() question

2002-11-04 Thread Graeme McLaren
Hi, Anyone know how I can use two mysql_fetch_array() functions similar
to the code below?  I've tried a few different ways but I keep getting
Resource ID #4.  I need to do this to retrieve an email address from one
table and retrieve details from another.

Cheers for any tips - I'm stumped with this one,

Graeme :)

$query = SELECT Name, Address FROM users; 
$query2 = SELECT EmailAddress From Members;

$result = mysql_query($query);
$result2 = mysql_query($query2);

while($details = mysql_fetch_array($result) and $Email =
mysql_fetch_array($result2))
{
echo Name: $details[Name];
echo Address: $details[Address];
echo Email: $Email[EmailAddress];
}






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




[PHP-DB] PHP Case Sensitivity

2002-11-03 Thread Graeme McLaren
Hey all, I've had a bizarre experience.  When I uploaded a php script it
worked fine and when I was looking through my code I found that it
shouldn't have worked because two variables had been used instead of
one.  What I'm meaning is, I used $Year and $year where I was just
supposed to use $Year, the case insensitivity didn't seem to make a
blind bit of difference.  I've corrected it now and the script runs as
it did previously.

Did PHP just correct this at run time?  Anyone know why this worked?


Cheers,

Graeme :)

P.S.  Seabird:  I had a quick look at your site, it seems to work fine
but I didn't look at it in any great depth.  But so far so good !




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




[PHP-DB] Infinite Loop?

2002-11-02 Thread Graeme McLaren
Greetings list members.  I've written the code below as part of an
automatic email script.  The problem with this is it seems to run in to
an infinite loop.  The for loop seems to get completely ignored by
emails get sent constantly.  I deleted the script after receiving 2500
emails ! :'( 

Can anyone point out what the problem with this is?


while($tmp = $NowUnix)
{

for($i=0; $i=2; $i++)
{
$sendto = [EMAIL PROTECTED];
$subject = Test Automatic Email;
$message = If you get this then age3.php works
$message = If you get this then age3.php works
$message = If you get this then age3.php works;

mail($sendto, $subject, $message);
}
}


Cheers,

Graeme :)


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




Re: [PHP-DB] Infinite Loop?

2002-11-02 Thread Graeme McLaren
Ah right, I thought that once the while loop condition is true it would
execute the for loop then quit once the for loop had reached its
condition.  But really, whats happening is the while loop is continuing
to run the for loop and then run through the while loop again.  Ok I've
got it now.  

Thanks for your advice.


Graeme :)

On Sat, 2002-11-02 at 20:41, Jason Wong wrote:
 On Sunday 03 November 2002 04:26, Graeme McLaren wrote:
  Greetings list members.  I've written the code below as part of an
  automatic email script.  The problem with this is it seems to run in to
  an infinite loop.  The for loop seems to get completely ignored by
  emails get sent constantly.  I deleted the script after receiving 2500
  emails ! :'(
 
  Can anyone point out what the problem with this is?
 
 
  while($tmp = $NowUnix)
 
 You're not updating $tmp or $NowUnix inside your loop.
 
 -- 
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 
 
 /*
 Time is an illusion perpetrated by the manufacturers of space.
 */
 
 
 -- 
 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] Dealing with Unchecked Checkboxes

2002-10-28 Thread Graeme McLaren
Hi all, thanks for all your replies, I got the problem with checkboxes fixed
:)

Cheers,

Graeme :)

- Original Message -
From: [EMAIL PROTECTED]
To: Graeme McLaren [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Monday, October 28, 2002 3:53 PM
Subject: Re: [PHP-DB] Dealing with Unchecked Checkboxes



 how about a default value...so if you use a CHECKBOX_FIELD1 ENUM('Y', 'N')
 DEFAULT N type of definition, then if box is not checked, then it will
 deault to N otherwise a Y will override the default.

 just a thoughtdont' know if it will work for you or not...
 Jeff



 Brent Baisley
 brent@landove   To: Graeme McLaren
[EMAIL PROTECTED]
 r.com   cc: [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] Dealing
with Unchecked Checkboxes
 10/28/2002
 10:49 AM






 If you want to have an answer for each item, you should use yes/no radio
 buttons. With checkboxes you only get yes answer, as you are aware.
 The assumption is that you could care less about no answers since you
 are only interested in the yes set.

 Checkboxes reveal yes answers, radio buttons can reveal yes or no
 (or perhaps no answer if there is no default).

 If you want to stick with checkboxes, then I would have a hidden field
 for each checkbox you have. The hidden field could then be set with a
 yes or no value via javascript and an onChange event capture.


 On Saturday, October 26, 2002, at 05:02 PM, Graeme McLaren wrote:

  Hey all, I'm trying to get my head around checkboxes.  I can insert
  checked checkboxes into a DB no problem but I get an error when the
  checkboxes are unchecked.
 --
 Brent Baisley
 Systems Architect
 Landover Associates, Inc.
 Search  Advisory Services for Advanced Technology Environments
 p: 212.759.6400/800.759.0577


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




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




[PHP-DB] Dealing with Unchecked Checkboxes

2002-10-26 Thread Graeme McLaren
Hey all, I'm trying to get my head around checkboxes.  I can insert checked 
checkboxes into a DB no problem but I get an error when the checkboxes are unchecked.  
I've used the following to try and handle unchecked checkboxes but I still get the 
error query was empty can anyone point me in the right direction?


$number=count($GiftWrapping); 
 for($a=0;$a$number;$a++)
{ 
 echo $GiftWrapping[$a];
 if ( empty( $GiftWrapping ) ) 
 {
 $GW = 'N';
 }

INSERT INTO DB CODE HERE

GiftWrapping = '$GW';

}


Cheers in advance,

Graeme :)


Public Sub House()

On Error Resume drink

 If Pint.empty = True Then
 Pint.refill
   Else
 Pint.drink
 End if

stomach.add Pint

MsgBox  I've had    stomach.count   Pints
MsgBox VERY DRUNK

End Sub




Re: [PHP-DB] Dealing with Unchecked Checkboxes

2002-10-26 Thread Graeme McLaren
Mihail, do u mean something like this?

?
if (!isset($pick)) {
echo Fill out and submit the form below.; }
else {
$j = count($pick);
for($i=0; $i$j; $i++) {
echo Pick b$pick[$i]/b is Checkedbr /; }
}
?

form action=? echo $PHP_SELF; ?
ol
liPaintinginput name=pick[] type=checkbox value=Painting //li
liPlumbinginput name=pick[] type=checkbox value=Plumbing //li
liElectricinput name=pick[] type=checkbox value=Electric //li
/ol

input type=submit value=Submit! /
input type=reset value=Reset /
/form


Cheers,

Graeme :)

- Original Message - 
From: Mihail Bota [EMAIL PROTECTED]
To: Micah Stevens [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Saturday, October 26, 2002 10:01 PM
Subject: Re: [PHP-DB] Dealing with Unchecked Checkboxes


 Try to assign a value for each of these variables, or elements of array.
 If it is checked let's say is =1,otherwise=0. Then grab the whole set of
 variables with GET_VARS or something like this. Create the new array in
 the page where you insert data, and then use if's to insert data in your
 tables.
 I am pretty sure is not the cleanest way, but I hope it makes sense.
 
 Mihai
 
 On Sat, 26 Oct 2002, Micah Stevens wrote:
 
  Unchecked checkboxed do not return a value. They don't return a NULL or
  empty string or anything. So what you have to do is check to see if the
  variable is set. If it is set, then it's checked, if it's not set, then
  it's unchecked.
 
  Kinda sucks if your variable names are dynamic, I just erase the whole
  record and re-insert in that case.
 
  -Micah
 
 
  At 09:02 PM 10/26/2002 +0100, Graeme McLaren wrote:
  Hey all, I'm trying to get my head around checkboxes.  I can insert
  checked checkboxes into a DB no problem but I get an error when the
  checkboxes are unchecked.  I've used the following to try and handle
  unchecked checkboxes but I still get the error query was empty can
  anyone point me in the right direction?
  
  
  $number=count($GiftWrapping);
for($a=0;$a$number;$a++)
  {
echo $GiftWrapping[$a];
if ( empty( $GiftWrapping ) )
{
$GW = 'N';
}
  
  INSERT INTO DB CODE HERE
  
  GiftWrapping = '$GW';
  
  }
  
  
  Cheers in advance,
  
  Graeme :)
  
  
  Public Sub House()
  
  On Error Resume drink
  
If Pint.empty = True Then
Pint.refill
  Else
Pint.drink
End if
  
  stomach.add Pint
  
  MsgBox  I've had    stomach.count   Pints
  MsgBox VERY DRUNK
  
  End Sub
 
 
 
 -- 
 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




[PHP-DB] Inserting checkbox data

2002-10-25 Thread Graeme McLaren
Hi all, I'm having a problem inserting a value from a checkbox into a MySQL DB.  I can 
print out what the variable holds, the problem is it just won't go into the DB.  Weird 
thing is when I login to SSH there isn't a NULL value for it instead that field is 
just blank.

Anyone got any ideas what the problem is?


The HTML that is used for the checkbox is:  

Gift Wrapping: input type=checkbox Name=GiftWrapping[] Value=\Y\


So it should theoretically insert Y into the DB

Here is the code that appears to be causing the problem:

$number=count($GiftWrapping); 
 for($a=0;$a=$number;$a++)
 { 
 echo $GiftWrapping[$a];
 $GW = $GiftWrapping[$a]; 
 echo $GW;
 } 

if ($Submit == Submit) {
  $sql = INSERT INTO SiteMember SET
FirstName = '$FirstName',
LastName = '$LastName'
Username = '$Username',
Password = '$Password',
GiftWrapping = '$GW';
 }


Thank you in advance for any help.

Graeme :)


Public Sub House()

On Error Resume drink

 If Pint.empty = True Then
 Pint.refill
   Else
 Pint.drink
 End if

stomach.add Pint

MsgBox  I've had    stomach.count   Pints
MsgBox VERY DRUNK

End Sub




Re: [PHP-DB] Inserting checkbox data

2002-10-25 Thread Graeme McLaren
Mihail, thanx for your advice, I've got it going now ! :)  Thank you !

Richard, your points were valid, the HTML code with the slashes was just a
copy n' paste from a PHP script and the comma I think I deleted by accident
so its all sorted now.


Thank you again!

Graeme :)
- Original Message -
From: Mihail Bota [EMAIL PROTECTED]
To: Graeme McLaren [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, October 25, 2002 7:47 PM
Subject: Re: [PHP-DB] Inserting checkbox data


 Graeme,

 first, extend the for loop over the if and the query for insertion of
 data. As you have it now, it just inserts the last element of the array.
 second, I think that the for loop should be $a$number. if you put =,
 then the loop is processing the array with the last value not assigned by
 you (an extra element in the array).
 Hope it helps.

 Mihai

 On Fri, 25 Oct 2002, Graeme McLaren wrote:

  Hi all, I'm having a problem inserting a value from a checkbox into a
MySQL DB.  I can print out what the variable holds, the problem is it just
won't go into the DB.  Weird thing is when I login to SSH there isn't a NULL
value for it instead that field is just blank.
 
  Anyone got any ideas what the problem is?
 
 
  The HTML that is used for the checkbox is:
 
  Gift Wrapping: input type=checkbox Name=GiftWrapping[] Value=\Y\
 
 
  So it should theoretically insert Y into the DB
 
  Here is the code that appears to be causing the problem:
 
  $number=count($GiftWrapping);
   for($a=0;$a=$number;$a++)
   {
   echo $GiftWrapping[$a];
   $GW = $GiftWrapping[$a];
   echo $GW;
   }
 
  if ($Submit == Submit) {
$sql = INSERT INTO SiteMember SET
  FirstName = '$FirstName',
  LastName = '$LastName'
  Username = '$Username',
  Password = '$Password',
  GiftWrapping = '$GW';
   }
 
 
  Thank you in advance for any help.
 
  Graeme :)
 
 
  Public Sub House()
 
  On Error Resume drink
 
   If Pint.empty = True Then
   Pint.refill
 Else
   Pint.drink
   End if
 
  stomach.add Pint
 
  MsgBox  I've had    stomach.count   Pints
  MsgBox VERY DRUNK
 
  End Sub
 
 



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




[PHP-DB] mysql_fetch_assoc question

2002-09-04 Thread Graeme McLaren

Hey all,

I managed to find that if I do:

$MemberID = mysql_query(SELECT ID FROM SiteMember WHERE Username =
'$valid_user');
$array = mysql_fetch_assoc($MemberID);
print_r($array);

this will produce:

Array ( [ID] = 3 )

All I want is the value 3 so that I can go ahead and insert that into the
Lookup table.

Any ideas how I can just extract this value?  I'm also not 100% clear on
what mysql_fetch_assoc does, can anyone explain it?


Cheers in advance,

Graeme :)


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