|
Posted by Jarrod on 10/10/51 11:52
hi J.o. aho
This is how its currently set up
function displayGallery($filer,$URL){
$dsArt = new DB();
$data = mysql_query("SELECT * FROM navigation ORDER BY position") or
die(mysql_error());
while($record = mysql_fetch_array($data))
{
$value1 = end($record);
if($record[position] < intval($value1))
{
echo'down';
}
else if($record[position] == '110')
{
echo'up';
}
else if($record[position] != '110' && $record[position] != '10')
{
echo 'up/down';
}
}
echo '<td></tr>';
}
it still doesnt work, the setup is get the first value from the postion tbl
and only display down, and the last position and only display up and
everything in between display up and down.
it works when you put absolute number in there but since they are going to
change i need it dynamic
"J.O. Aho" <user@example.net> wrote in message
news:4hbo70F1ps4ajU1@individual.net...
> Jarrod wrote:
>> Hi there,
>>
>> I am trying to get the value of the varible into an if statment that will
>> determine what to do.
>>
>> The value is from the end of an array, this works fine when i use echo to
>> print it out onto the page but cant pass the value into the if statement,
>> can someone please help me
>>
>> $testing = '10';
>> $end = end($array); // this would equal to 10
>
> in this example, the array is empty, so you need to assign a value to the
> array.
>>
>> if($testing == $end){
>> print 'yes';
>> }else{
>> print 'no';
>> }
>>
>
> Try this one instead
>
> $testing = '10';
> $array = array(1,2,3,10);
> $end = end($array); // this would equal to 10
>
>
> if($testing == $end){
> print 'yes\n';
> }else{
> print 'no\n';
> }
>
>
> If you want to give up end(), you can use:
> $testing = '10';
> $array = array(1,2,3,10);
> $end = $array[count($array)-1];
>
>
> if($testing == $end){
> print 'yes\n';
> }else{
> print 'no\n';
> }
>
>
> If I would be you, I would try to keep integers as integers and not as
> strings, so I would have used '$testing = 10;' instead of what you have.
>
>
> //Aho
Navigation:
[Reply to this message]
|