Solved

php IF statement

Posted on 2015-02-22
5
44 Views
Last Modified: 2015-02-27
I have the following code in a working PHP page but this stops it loading:
----------------------
$im_art = $_GET['artist'];

<?php if ($im_art = "El Glinoer") {
<div class="body_text_large_artists" align="left"><?php echo $row_artInfo[artinf_Name]; ?></div><div class="body_text_large_cv"><a href="artistInfoCV.php?artist=<?php echo urlencode($im_art); ?>" target="_parent">Artist's CV</a><div class="div_archives_link"><a href="artistInfoArchives.php?artist=<?php echo urlencode($im_art); ?>" target="_parent">Archived&nbsp;Images</a> }
----------------------

Any ideas anyone ?
0
Comment
Question by:doctorbill
  • 3
  • 2
5 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 40624602
$im_art = "El Glinoer" with a single '=' is an assignment.  $im_art == "El Glinoer" with two '==' is a comparison which is what you usually want.  Other problems too.  This may work better.
<?php if ($im_art == "El Glinoer") { ?>
<div class="body_text_large_artists" align="left"><?php echo $row_artInfo[artinf_Name]; ?></div>
<div class="body_text_large_cv"><a href="artistInfoCV.php?artist=<?php echo urlencode($im_art); ?>" target="_parent">Artist's CV</a>
<div class="div_archives_link"><a href="artistInfoArchives.php?artist=<?php echo urlencode($im_art); ?>" target="_parent">Archived&nbsp;Images</a> 
<?php } ?>

Open in new window

0
 

Author Comment

by:doctorbill
ID: 40624610
Thanks Dave - perfect
0
 

Author Comment

by:doctorbill
ID: 40635843
I've requested that this question be closed as follows:

Accepted answer: 500 points for Dave Baldwin's comment #a40624602
Assisted answer: 0 points for doctorbill's comment #a40624610

for the following reason:

solved within 5 minutes
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40624683
You're welcome.!
0
 

Author Closing Comment

by:doctorbill
ID: 40635844
complete
0

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question