Jump to content


Photo

Question about MYSQL/PHP


  • Please log in to reply
3 replies to this topic

#1 medj

medj
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 15 September 2006 - 02:37 AM

by default, my script request MYSQL information from a database. The line I need help with is:

LIKE '$c'

I have a number of categories on my site that use the variable $c

In this mysql line, i dont want to grab info from the database with variable $c but with the variable $c + the word 'media' on the end of it.

I've tried doing                  LIKE '$cmedia'        doesnt work obviously since $cmedia is a whole new variable entirely.

I've tried              LIKE '$c+media'        doesnt work


Please anyone?



#2 btherl

btherl
  • Staff Alumni
  • Advanced Member
  • 3,893 posts
  • LocationAustralia

Posted 15 September 2006 - 03:21 AM

Here are two options:

" LIKE '$c" . "media" . "'"
" LIKE '{$c}media'"

You can even do complex stuff like "{$arr['fortytwo'][5]}media'".  Those {} symbols are very handy :)

#3 medj

medj
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 15 September 2006 - 03:33 AM

Thanks so Much  ;D

You just saved me tons of time.

Maybe you can tell me what you think of my site:

http://blankevolution.com

#4 btherl

btherl
  • Staff Alumni
  • Advanced Member
  • 3,893 posts
  • LocationAustralia

Posted 15 September 2006 - 04:00 AM

Nice colours and layout.. I'm at work so I'm not going to look any closer :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users