-3

I am having two problems, one of them odd and the other confusing.

Firstly I have basically the same code in two pages and in one page it works and in the other it comes up with an error.

   echo "<td style='width: 800px'>" . '<img height="100" width="100" src="data:image/jpeg;base64,'.base64_encode( $row[photo] ).'" >' . "</td>";

This comes up with the error Use of undefined constant photo - assumed 'photo'. Which to me means syntax error but for the life of me I cannot work out what needs to be done.php/html syntax can absolutely baffle the hell out of me.

The second problem is just an odd problem.

a:link {
  color: black;
}

Links are black.

a:hover {
  color: #4cff00 ;
}

links turn green when the mouse is hovered on them.

a:visited  {
color:black;
}

Links are no longer green when hovered over but instead are always black. I would like them to be green when hovered over but black at every other time, I cannot seem to get this.

ʰᵈˑ
  • 11,279
  • 3
  • 26
  • 49
Murphy
  • 3
  • 7
  • [Why is `$foo[bar]` wrong?](http://php.net/manual/en/language.types.array.php#language.types.array.foo-bar) – deceze Nov 03 '14 at 11:35
  • because php is parse it as a constant. since, there are no constant like `photo` this error message will appear what OP show us. – vaso123 Nov 03 '14 at 11:36

2 Answers2

1

Use $row["photo"] for your first problem. Add quotes or double quetes around your key photo, because if not, php parse as a constant.

For your css problem:

a:link, a:active, a:visited {color: #000}
a:hover {color: #4cff00;} 

You need to set all other cases to black with pesudo codes.

vaso123
  • 12,347
  • 4
  • 34
  • 64
  • Thank you very much, I do not understand when which quotations should be used, sometimes " sometimes ' sometimes ` or sometimes a combination of them. Thank you though. – Murphy Nov 03 '14 at 11:35
  • Alternatively, just use `a:hover {color:#4cff00 !important;}`. "It'll do." – Dave Salomon Nov 03 '14 at 11:37
  • @Hammond : http://stackoverflow.com/questions/3446216/what-is-the-difference-between-single-quoted-and-double-quoted-strings-in-php – DarkBee Nov 03 '14 at 11:37
  • read here: http://stackoverflow.com/questions/3446216/what-is-the-difference-between-single-quoted-and-double-quoted-strings-in-php – vaso123 Nov 03 '14 at 11:37
0

try with -

base64_encode( $row["photo"] );
Sougata Bose
  • 31,517
  • 8
  • 49
  • 87