Solved

php IF statement

Posted on 2015-02-22
5
42 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 82

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 82

Expert Comment

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

Author Closing Comment

by:doctorbill
ID: 40635844
complete
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now