You are here: Re: While Loop Question... « All PHP « IT news, forums, messages
Re: While Loop Question...

Posted by J.O. Aho on 01/23/06 14:34

GM wrote:
> Hi All
>
> I'm trying to create a loop in PHP which will do the following for me :-
>
> 1. Get a count of rows from a table where the current time is greater than
> the expired_time.
> 2. Based on that, we need to get the customercode from that table, to be
> able to get an e-mail address from another table where the customercode
> matches.
> 3. Send a notification to the email address to inform the client that the
> time has expired.
>
> For now, I have left out the e-mail address part as well as the actual
> e-mail sending part. I guess that will happen in the same loop. For now, I
> am just trying to get a list of the customercodes. Don't know if i'm on the
> right track here...
>
> <?
> include "../includes/mysqlcon.php";
> echo "hello...";
>
> $current_time = date("Y-m-d H:i:s");
>
> $count = mysql_query("SELECT count(nid) FROM nack_ack where '$current_time'
> > date_expired");
> $numrows = mysql_num_rows($count);
>
> $i = 1;
>
> while ($i <= $numrows) {
>
> $querycustomercode = mysql_fetch_row(mysql_query("SELECT * from nack_ack
> WHERE nid = '$i'"));
> $customercode = $querycustomercode[1];
>
> echo $customercode;
>
> }
> ?>
>
>

<?
include "../includes/mysqlcon.php";
echo "hello...";

$current_time = date("Y-m-d H:i:s");

$count = mysql_query("SELECT count(nid) FROM nack_ack where '$current_time' >
date_expired");
$numrows = mysql_num_rows($count);

$querycustomercode = mysql_query("SELECT * from nack_ack WHERE nid <
'$numrows' ORDER BY nid ASC");

while($row=mysql_fetch_row($querycustomercode)) {
$customercode = $row[1];
echo $customercode;
}
?>



//Aho

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация