Solved

IF statement php

Posted on 2015-02-07
4
200 Views
Last Modified: 2015-02-07
Can someone please tell me how to rewrite this statement so that it represents a value:

<?php if (!empty($row_artGallery[artgal_fsize])

example:
<?php if ($row_artGallery[artgal_fsize]) = "cm"
0
Comment
Question by:doctorbill
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 43

Accepted Solution

by:
Chris Stanyon earned 250 total points
ID: 40595882
Comparison in PHP is the double equals, and the whole IF statement should be wrapped in parenthesis

<?php if ($row_artGallery['artgal_fsize'] == "cm") {
...
}

Open in new window

0
 
LVL 10

Assisted Solution

by:aboo_s
aboo_s earned 250 total points
ID: 40595886
<?php if ($row_artGallery[artgal_fsize] .src=="/images/flower.jpg") echo "found!";
0
 

Author Comment

by:doctorbill
ID: 40595907
perfect - thanks
0
 

Author Closing Comment

by:doctorbill
ID: 40595910
solution
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

632 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