Jump to content

A little problem, quick to fix.


Bikkebakke

Recommended Posts

So, sorry for asking such a simple question but I couldn't find any info on what causes this or what did I do wrong.

 

Heres my code:

$monsterID = rand(10,10);
$monster = mysql_query("SELECT name FROM monsters WHERE id = 'like {$mosnterID}'");

And:

echo "You encounter {$monster}";

 

Shows as:

You encounter Resource id #4

 

I want it to return the name of the monster by looking up the ID of the monster.

 

Is it my db table or is the mysql_query invalid or something?

 

Thanks in advance and sorry for bothering you.

Link to comment
https://forums.phpfreaks.com/topic/191517-a-little-problem-quick-to-fix/
Share on other sites

I've read trough a few good tutorials over the week I've been studying PHP/MySQL but didn't find help, that's why I'm asking for some. You know it's hard to find a solution to a problem if you don't know where the problem is.  :(

 

Thanks for the answer, even if it doesn't help me at all. (Rather than telling whats happening you could tell whats the issue here)

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.