[nycphp-talk] Help!!
jose sanchez
j_r_sanchez at yahoo.com
Wed May 29 17:23:37 EDT 2002
--- JeeBak Kim <jbkim at cs.pdx.edu> wrote:
> * jose sanchez (j_r_sanchez at yahoo.com) [020529
> 12:21]:
> [snip]
> >
> > In my original code the {} were in place. This is
> not
> > causing the problem..
>
> Hmm... could you post your original code instead of
> the code
> you posted to the list earlier (the one with the
> missing {}'s?)
> It's hard to make a diagnosis if they are different
> ;).
Here's the original code:
$text_path ='NULL';
$text = array( 0,0,0,0,0 );
$text_ads_count = 5
$current = 1;
This function will be called 4 or five times per page
like this:
<tr>
<td>
<?
get_text_ad( $current++ );
include( $text_path );
?>
</td>
</tr>
function get_random_number( $m, $l )
{
srand((double) microtime() * 1000000);
return rand( $m, $l );
}
function get_text_ad( $cur ){
global $text_path, $text, $text_ads_count;
// set the current table to be used
$table_name = 'ads_text';
$update_field = 'presence';
if( $cur == 1 )
{
$id = get_random_number( 1, $text_ads_count );
// Based on this number select the record from the
db
$sql = "select path from $table_name where
ad_id=$id";
$result = runQuery( $sql );
list( $text_path ) = mysql_fetch_array( $result );
$text[$cur] = $id;
update_table( $table_name, $id, $update_field);
}// end if first occurrance
else
{
while( !checkit( $id = get_random_number( 1,
$text_ads_count ) ) ){
// Based on this number select the record from the
db
$sql = "select path from $table_name where
ad_id=$id";
$result = runQuery( $sql );
list( $text_path ) = mysql_fetch_array( $result );
$text[$cur] = $id;
update_table( $table_name, $id, $update_field );
}// end while loop
}//end else
}// end function get_text********************
function checkit( $g ){
global $text, $id;
for( $i = 1; $i <= 6; $i++ )
{
if( $text[$i] == $g )
{
print( 'ID: ' . $id . '<br>I: ' . $i . '<br>Text[' .
$i . ']: ' . $text[$i] .
'<br>g: ' . $g );
return true;
}
}
return false;
}
Thanks.
=====
"An ounce of gold cannot buy an ounce of time."
- Anonymous
www.whmicro.com
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
More information about the talk
mailing list