Variable not implementing correctly from if statement

Posted by swiftsly on Stack Overflow See other posts from Stack Overflow or by swiftsly
Published on 2013-10-24T21:50:57Z Indexed on 2013/10/24 21:53 UTC
Read the original article Hit count: 206

Filed under:
|
|
|
|

I have an if statement that is supposed to set the variable $pc162v to a link specified in the MySQL table if content exists in the $vid column of the row. The problem is, the PHP is detecting that there's a link in the MySQL, but isn't setting the $pc162v variable correctly.

Here's the variable declarations:

$pc162v = "";
$vid162 = '<embed width="420" height="236" src="'.$pc162v.'" type="application/x-shockwave-flash"></embed>';

Here's the section of the if statement:

if (empty($row[7])) {
   $vid162 = '';
}
else {
   $pc162v = $row[7];
}

In my web browsers, the part of the code where the variable $vid162 is used, shows up as the following:

<embed width="420" height="236" src="" type="application/x-shockwave-flash">

I have also tried setting $vid162 to:

<embed width="420" height="236" src="<?php echo $pc162v; ?>" type="application/x-shockwave-flash"></embed>

and that just makes the code in my web browser:

<embed width="420" height="236" src="<?php echo $pc162v; ?>" type="application/x-shockwave-flash">

Hope someone has a solution! Thanks in advance.

© Stack Overflow or respective owner

Related posts about php

Related posts about html