RE: re: php3 vs ph4 mail() function (help)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If you don't have any criteria and want to loop through all the records just
"SELECT $emailcol from $tablename" and then loop through the result set.  If
you want something that matches part of the column use "SELECT $emailcol
from $tablename WHERE $colname LIKE '$somepattern'" and loop through, if you
want an exact match use "SELECT $emailcol from $tablename WHERE $somecol =
'$somecriteria'".  As I said before the example I gave is very basic and
generic, you will need to customize the queries to do what you want.

This is very basic PHP and SQL, so I'm going to assume you can figure this
out on your own by looking at the PHP Manual (try
http://www.php.net/manual/en/ref.mysql.php and
http://www.php.net/manual/en/function.mail.php) and the mySQL manual (try
the part on SELECT syntax http://www.mysql.com/doc/en/SELECT.html).

> -----Original Message-----
> From: JeRRy [mailto:jusa_98@yahoo.com]
> Sent: Thursday, April 10, 2003 7:21 PM
> To: Jennifer Goodie
> Subject: RE:  re: php3 vs ph4 mail() function (help)
>
>
> Hi Jennifer,
>
> > $link = mysql_connect($host,$user,$pw) or
> > die(mysql_error());
> > mysql_select_db($dbname) or die(mysql_error());
> > $query = "SELECT $emailcol from $tablename WHERE
> > $somecol =
> > '$somecriteria'";
> > $result = mysql_query($query) or die(mysql_error());
> > $emailaddress = mysql_result($result,0) or
> > die(mysql_error());
> >
> mail($emailaddress,$subject,$message,$additionalheaders);
> hmmm... Okay I think I may have found my problem in my
> code.  I'll quote your post:
>
> <QUOTE>
> $query = "SELECT $emailcol from $tablename WHERE
> $somecol ='$somecriteria'";
> </QUOTE>
>
> WHERE statement ... What would I set the 'criteria' to
> be?  EMail address are like (as you know)
> bob@yahoo.com I have tried putting '@" as the criteria
> but it over looks the symbol entily.  I try other ways
> but instead of looking for matches it looks for an
> EXACT match.  Well appears that way because it pulls
> nothing out of the query.  But if I type a 'criteria'
> that is an exact match it pulls it out.  Any idea why?
>
> This may or may not be right but it appears to be the
> case.  As when I go into mysql and do a select query
> with a criteria it fails there also.  But exact
> matches works.
>
> Maybe my cols type are setup wrong?
>
> Jerry
>
> > > -----Original Message-----
> > > From: JeRRy [mailto:jusa_98@yahoo.com]
> > > Sent: Thursday, April 10, 2003 6:59 PM
> > > To: robleyd@ozemail.com.au
> > > Cc: php-db@lists.php.net
> > > Subject:  re: php3 vs ph4 mail() function
> > (help)
> > >
> > >
> > > (assuming
> > >
> > > you are using Win) or may have a different value
> > for
> > > your sendmail call
> > > (for *nix)
> > > I am using linux, not win. (eck)  I don't like Win
> > for
> > > server applications or anything like that, prefer
> > the
> > > good 'ol linux systems.
> > >
> > > In essence, mail() under php3 is no different to
> > mail
> > > under php4.
> > > Well that is what I thought also.  But I just
> > copied
> > > my scriopts over to another host and they are
> > > rejecting them also.  They use php4 also.  So
> > > something in my code (or alot of it) is funny with
> > > php4 but works under php3.  That is why I seeked a
> > > basic code that could point me in the right
> > direction.
> > >  As my code does not wanna look at php4.  There is
> > no
> > > such code errors as it says the email sent when it
> > > never...  So it's something to do with my mail()
> > > functions rather than my connection.  (i think)
> > >
> > > If you have a basic code I could look at and add
> > my
> > > values myself that would be great.  Basically I
> > need a
> > > code that will fetch email addresses from a mysql
> > > database and send via email a message.
> > >
> > > It appears some people are backing off this
> > question
> > > maybe because they are not aware of how to do it.
> > >
> > > I appreciate honesty from this 1 person, who
> > > eventually said I can't help sorry.  After saying
> > he
> > > could but in the end he really never knew or miss
> > > understood the question.  If you can't do it say
> > so,
> > > don't say in the terms you can help but not now
> > and
> > > waste other peoples times. I trust you know how to
> > do
> > > this as you responded.
> > >
> > > I believe posting the code on this board also
> > would
> > > help others, and would save re-posting it later as
> > > people can look back and find this thread to
> > answer
> > > their question.  And also I can refrence this
> > thread
> > > for future reference.
> > >
> > > All help is appreicated, and surely someone out
> > there
> > > can help me.  It's sounds basic but I can't get
> > around
> > > to why my old code won't work.
> > >
> > > Thanks!
> > >
> > >
> > > --
> > > Quod subigo farinam
> > >
> > > $email =~ s/oz$/au/o;
> >
> > >
> >
>
> http://mobile.yahoo.com.au - Yahoo! Mobile
> - Check & compose your email via SMS on your Telstra or Vodafone mobile.
>


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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux