FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » isset not working with select
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: isset not working with select [message #181431 is a reply to message #181423] Wed, 15 May 2013 23:54 Go to previous messageGo to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
On Wed, 15 May 2013 17:12:36 -0400, richard wrote:

> On Wed, 15 May 2013 20:34:30 +0000 (UTC), Denis McMahon wrote:
>
>> On Wed, 15 May 2013 16:23:35 -0400, richard wrote:
>>
>>> if (isset($cov[0]) && is_string($cov[0]) && strlen(cov[0])>4)
>>> { echo "<img src='http://mroldies.net/covers/$year/".$cov[0]."'>"; }
>>>
>>> Returns a parse error of unexpected '['.
>>> where did I screw up at?
>>
>> I wrote: strlen( $cov[0] ) > 4 You wrote: strlen(cov[0])>4
>>
>> You missed a $ in the "strlen( $cov[0] ) > 4" test. That missing "$"
>> character is significant!
>>
>>> I want to check both images separately as I may have one set, but not
>>> both.
>>
>> Not unreasonable
>
> Ok so the code still shows the place holders for both.

I'm not 100% sure on how you have implemented the code.

Let me expand on the previous example - this generates separate images
for the two covers:

Given:

$cov = mysql_fetch_row($result);

Then:

if ( isset( $cov[0] ) && is_string( $cov[0] ) && strlen( $cov[0] ) > 4 ) {

// here you use $cov[0] in the output

echo "<img src='http://mroldies.net/covers/{$year}/{$cov[0]}'>";

/* --- in here --- */

} else {

// here you have an alternative output for $cov[0]

echo "Image 1 Not Available"

}

/* --- from here --- */
if ( isset( $cov[1] ) && is_string( $cov[1] ) && strlen( $cov[1] ) > 4 ) {

// here you use $cov[1] in the output

echo "<img src='http://mroldies.net/covers/{$year}/{$cov[1]}'>";

} else {

// here you have an alternative output $cov[1]

echo "Image 2 Not Available"

}
/* --- to here --- */

If however you only want the second image to display if the first image
is also present, then all the lines from the comment "/* --- from here
--- */" to the comment "/* --- to here --- */" should be moved up to the
place held by the comment "/* --- in here --- */"

You might in that case want to change the text output "Image 1 Not
Available" to "Images Not Available"

--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: mkdir no such file or directory
Next Topic: makes searching and booking applications airfares
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Dec 01 03:22:22 GMT 2024

Total time taken to generate the page: 0.04392 seconds