Re: [PHP-DB] grabbing data and auto email set users

2006-04-10 Thread JeRRy
Hi,
   
  Okay I played with the code a bit and ended up with this, it does NOT produce 
errors but it's not doing anything.  Connects to the db but does not do the 
mail out.  Maybe I missed something said before, but here you go, the link 
below with the code.  (it's probably basic)
   
  http://pastebin.com/650846
   
  J
   
  

Chris [EMAIL PROTECTED] wrote:
  JeRRy wrote:
 Hi,
 
 Okay I must be missing something here.
 
 I changed it to mysql_query and no errors produce however no emails 
 are sent either. After cross-checking back and fourth with my db the 
 entries are correct.
 
 A connection is made and establlished. maybe I need to place some eror 
 recording to see where it's failing.
 
 I can't seem to get it to work, changed a heap of code but nothing budges. 
 
 I can send the code I have and table structure if you want.

Post it on http://www.pastebin.com and send us the url.

-- 
Postgresql  php tutorials
http://www.designmagick.com/



Re: [PHP-DB] grabbing data and auto email set users

2006-04-10 Thread Chris

JeRRy wrote:

Hi,
 
Okay I played with the code a bit and ended up with this, it does NOT 
produce errors but it's not doing anything.  Connects to the db but does 
not do the mail out.  Maybe I missed something said before, but here you 
go, the link below with the code.  (it's probably basic)


You're mixing up your ideas.

Try this.

http://pastebin.com/650869


(the Mail function call was completely wrong - read the manual - 
http://www.php.net/mail)



--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] grabbing data and auto email set users

2006-04-10 Thread Chris

JeRRy wrote:

Hi,
 
Okay I played with the code a bit and ended up with this, it does NOT 
produce errors but it's not doing anything.  Connects to the db but does 
not do the mail out.  Maybe I missed something said before, but here you 
go, the link below with the code.  (it's probably basic)


Actually try this one:

http://pastebin.com/650871

You had an extra loop just for 'tippings' but never used it anywhere.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] grabbing data and auto email set users

2006-04-10 Thread JeRRy
Okay, but still not working...
   
  is NULL the same as ' '?  Or does NULL have to be the inserted value in the 
db?
   
  J
   
  

Chris [EMAIL PROTECTED] wrote:
  JeRRy wrote:
 Hi,
 
 Okay I played with the code a bit and ended up with this, it does NOT 
 produce errors but it's not doing anything. Connects to the db but does 
 not do the mail out. Maybe I missed something said before, but here you 
 go, the link below with the code. (it's probably basic)

Actually try this one:

http://pastebin.com/650871

You had an extra loop just for 'tippings' but never used it anywhere.

-- 
Postgresql  php tutorials
http://www.designmagick.com/



Re: [PHP-DB] grabbing data and auto email set users

2006-04-10 Thread Chris

JeRRy wrote:

Okay, but still not working...
 
is NULL the same as ' '?  Or does NULL have to be the inserted value in 
the db?


Null means unknown - so completely different to ' ' or ''.

How was your table created?

What do you get if you run that query through phpmyadmin:

select username from round3 where misc=NULL;

?

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] grabbing data and auto email set users

2006-04-10 Thread JeRRy
Hi,
   
  Ahh okay I thought NULL was blank.  Okay I understand, therefore, hehe, I 
fixed it.
   
  snip
   
  $query = select username from round3 where misc='';

   
  fixed it, the email got sent.  
   
  Had to change a few strings also to match my database which I was not aware 
of.  Forgot it actually.
   
  Now the only thing I need to know is how do I change the sender email is, 
currently it sets to the server default username.  (e.g. [EMAIL PROTECTED])  Is 
there a way to change that and the subject.
   
  Thanks for your time.  I have learned a little bit off this also.  So 
thankyou.
   
  J

Chris [EMAIL PROTECTED] wrote:
  JeRRy wrote:
 Okay, but still not working...
 
 is NULL the same as ' '? Or does NULL have to be the inserted value in 
 the db?

Null means unknown - so completely different to ' ' or ''.

How was your table created?

What do you get if you run that query through phpmyadmin:

select username from round3 where misc=NULL;

?

-- 
Postgresql  php tutorials
http://www.designmagick.com/



Re: [PHP-DB] grabbing data and auto email set users

2006-04-10 Thread Chris

JeRRy wrote:

Hi,
 
Ahh okay I thought NULL was blank.  Okay I understand, therefore, hehe, 
I fixed it.
 
snip
 
$query = select username from round3 where misc='';
 
fixed it, the email got sent. 
 
Had to change a few strings also to match my database which I was not 
aware of.  Forgot it actually.
 
Now the only thing I need to know is how do I change the sender email 
is, currently it sets to the server default username.  (e.g. 
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED])  Is there a 
way to change that and the subject.


You set the subject:

mail($to, $subject, $message, $headers);

You can set the From in the headers:

$headers = From: your_email_address\n;
$headers .= Reply-To: your_email_address\n;

See http://www.php.net/mail for more info.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] grabbing data and auto email set users

2006-04-10 Thread JeRRy
Okay I have the emails to work now, thanks so much Chris.  But now I have 
encountered another problem, I hope you don't mind helping, I am obviously 
missing again something basic.  Basic than before.
   
  I have this code:
   
  $result = mysql_query(SELECT `nickname`  FROM tipping
WHERE 1
ORDER BY `score`
DESC LIMIT 0, 30,$db);
  while ($myrow = mysql_fetch_row($result)) {
  printf(
brinput type=text name=username[$a] value=%s br,
$myrow[0]);
  }
  ?
   
  which displays all the users names.
   
  than I want to push it to another page that tells the db to update, one 
username per record.  Code below:
   
$query = insert into round3 SET username='$username[$a]';
mysql_query($query);
echo( );
}
  else {echo(Ooops, something bad happened!  Please try again shortly.);}
  ?
  a href=admin.phpBACK/a

  input type=submit value=submit
/form
/p
   
  But when I check the db this is what I get.
   
  A new record created but username is blank.
   
  So it's creating a new record but leaving it blank, why?
   
  Now at times the record will insert more than one record, so I need it able 
to update more than one record at a time.
   
  Any help?
   
  J


Chris [EMAIL PROTECTED] wrote:
  JeRRy wrote:
 Hi,
 
 Ahh okay I thought NULL was blank. Okay I understand, therefore, hehe, 
 I fixed it.
 
 
 
 $query = select username from round3 where misc='';
 
 fixed it, the email got sent. 
 
 Had to change a few strings also to match my database which I was not 
 aware of. Forgot it actually.
 
 Now the only thing I need to know is how do I change the sender email 
 is, currently it sets to the server default username. (e.g. 
 [EMAIL PROTECTED] ) Is there a 
 way to change that and the subject.

You set the subject:

mail($to, $subject, $message, $headers);

You can set the From in the headers:

$headers = From: your_email_address\n;
$headers .= Reply-To: your_email_address\n;

See http://www.php.net/mail for more info.

-- 
Postgresql  php tutorials
http://www.designmagick.com/



[PHP-DB] Result set in different columns

2006-04-10 Thread Mark Bomgardner
I am trying to work through some display logic where I want to display a 
results set from a database query into to columns in a table, but I 
can't see to get it correct.


Example; I want to loop through the months of the year and display them 
like this;


   JanuaryFebruary
   March  April
   MayJune
   JulyAugust
   September  October
   November   December

Any ideas?


Mark Bomgardner

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



RE: [PHP-DB] Result set in different columns

2006-04-10 Thread Bastien Koert

$cols = 2;
echo tabletr;


while ($rows = mysql_fetch_array($result))
{
 if (($cols % 2) == 0 ){ echo /trtr; }

 echo td.$rows['something']./td;
 $c++;
}

echo /tr/table;


bastien



From: Mark Bomgardner [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: Php-Db php-db@lists.php.net
Subject: [PHP-DB] Result set in different columns
Date: Mon, 10 Apr 2006 09:00:06 -0500

I am trying to work through some display logic where I want to display a 
results set from a database query into to columns in a table, but I can't 
see to get it correct.


Example; I want to loop through the months of the year and display them 
like this;


   JanuaryFebruary
   March  April
   MayJune
   JulyAugust
   September  October
   November   December

Any ideas?


Mark Bomgardner

--
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] grabbing data and auto email set users

2006-04-10 Thread Dwight Altman
How about:
$result = mysql_query($query);
while ($row = mysql_fetch_assoc($result)) {
instead of your line 6 and 7?

And why are you going back to db_query on line 9 instead of staying with
mysql_query?

Also, you might want to check $num_rows = mysql_num_rows($result);
instead of
line 10 $has_tipped = mysql_query($result_two);
and line 12 if (empty($has_tipped)) {
or do a while ($row = mysql_fetch_assoc($result_two)) {
(notice $result_two here) enclosing the mail command.

To recap:
Get a $result set from the mysql_query()
Get a $row from a while ($row = mysql_fetch_assoc($result)) {


-Original Message-
From: JeRRy [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 10, 2006 2:37 AM
To: Chris
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] grabbing data and auto email set users

Hi,
   
  Okay I played with the code a bit and ended up with this, it does NOT
produce errors but it's not doing anything.  Connects to the db but does not
do the mail out.  Maybe I missed something said before, but here you go, the
link below with the code.  (it's probably basic)
   
  http://pastebin.com/650846
   
  J
   
  

Chris [EMAIL PROTECTED] wrote:
  JeRRy wrote:
 Hi,
 
 Okay I must be missing something here.
 
 I changed it to mysql_query and no errors produce however no emails 
 are sent either. After cross-checking back and fourth with my db the 
 entries are correct.
 
 A connection is made and establlished. maybe I need to place some eror 
 recording to see where it's failing.
 
 I can't seem to get it to work, changed a heap of code but nothing budges.

 
 I can send the code I have and table structure if you want.

Post it on http://www.pastebin.com and send us the url.

-- 

Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] grabbing data and auto email set users

2006-04-10 Thread Chris

JeRRy wrote:
Okay I have the emails to work now, thanks so much Chris.  But now I 
have encountered another problem, I hope you don't mind helping, I am 
obviously missing again something basic.  Basic than before.
 
I have this code:
 
$result = mysql_query(SELECT `nickname`  FROM tipping

WHERE 1
ORDER BY `score`
DESC LIMIT 0, 30,$db);
while ($myrow = mysql_fetch_row($result)) {
printf(
brinput type=text name=username[$a] value=%s br,
$myrow[0]);
}
?
 
which displays all the users names.
 
than I want to push it to another page that tells the db to update, one 
username per record.  Code below:
 
  $query = insert into round3 SET username='$username[$a]';

mysql_query($query);
echo( );
}
else {echo(Ooops, something bad happened!  Please try again 
shortly.);}

?
a href=admin.phpBACK/a
input type=submit value=submit
/form
/p
 
But when I check the db this is what I get.
 
A new record created but username is blank.


Where is $username[$a] meant to come from? You don't show enough code 
about this to work out why.


Are you posting the results? Are you getting it from a select box? other 
... ?


--
Postgresql  php tutorials
http://www.designmagick.com/

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