Jump to content


idk what to call it


4 replies to this topic

#1 pirateXcore

    Young Padawan

  • Members
  • Pip
  • 281 posts
  • Gender:Male

Posted 22 August 2006 - 07:26 AM

Okay, when showing an image, I want the alt & title to be one of my mysql fields.
alt=".htmlspecialchars($row['artist'])." title=".htmlspecialchars($row['artist']).">";
That's the code for them currently. It only takes the first word from the field though! How can I get it to take everything from that field?
Thanks :rolleyes:

#2 venomsnake

    Jedi In Training

  • Members
  • PipPip
  • 481 posts
  • Gender:Male

Posted 22 August 2006 - 11:35 AM

$artist = htmlspecialchars($row['artist']);

alt=".$artist." title=".$artist.">";

Try that, idk if it will fix it, im thinking it will, ive never had that happen to me before

#3 danieldaniel

    Young Padawan

  • Members
  • Pip
  • 75 posts
  • Gender:Male
  • Location:Columbus, Ohio
  • Interests:Skateboarding, Macs, BMX, Cocoa, PHP, CSS etc.

Posted 22 August 2006 - 01:10 PM

View Postvenomsnake, on Aug 22 2006, 12:34 PM, said:

$artist = htmlspecialchars($row['artist']);

alt=".$artist." title=".$artist.">";

Try that, idk if it will fix it, im thinking it will, ive never had that happen to me before

Theres no need to have it like this:

alt=".$artist."

if it isn't an array. Also tgs, why are you using htmlspecialchars from the database?

$artist = $row['artist'];

alt=\"$artist\" title=\"$artist\">";

That should work. I escaped the quotes, I dont't know how you had it without them being escaped.

#4 pirateXcore

    Young Padawan

  • Members
  • Pip
  • 281 posts
  • Gender:Male

Posted 22 August 2006 - 02:42 PM

Works perfectly, although $artist = $row['artist']; isn't needed.
:biggrin: Thank you.

#5 coolaid

    P2L Jedi Master

  • Members
  • PipPipPipPip
  • 1,435 posts
  • Gender:Male
  • Interests:i wonder..

Posted 22 August 2006 - 06:08 PM

btw, you should be htmlspecialchar'ing before entering it into the database





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users