Jump to content

[SOLVED] Resource ID #3????


Obsession

Recommended Posts

I get "Resource ID #3" for the result of a query, which has me completely baffled.

 

Any ideas?

 

The code that generates this answer-

 

<?php 
$con=mysql_connect('localhost','root','');
mysql_select_db('LolStrat',$con);
$Champion=$_GET['Champion'];
echo $Champion;
$Tag=mysql_query("SELECT Tag FROM champions WHERE Name='$Champion'");
echo "<br>";
echo $Tag;
?>

 

The first part works, it fetches the champion name from the URL and prints that. Then I want the query to find the tag of that champion, easily enough explained by the query. I thought $Tag would therefore be "The ChronoKeeper", which is what the database has for that record, only it prints "Resource id #3" in those exact words...

 

Ideas?

 

Thanks.

 

Edit- After a bit more googling, I got some examples and tried those, to no success.

 

<?php 
$con=mysql_connect('localhost','root','');
mysql_select_db('LolStrat',$con);
$Champion=$_GET['Champion'];
echo $Champion;
$queryone=mysql_query("SELECT Tag FROM champions WHERE Name='$Champion'");
$Tag=mysql_fetch_row($queryone); 
echo "<br>";
echo $Tag;
?>

 

This generates the word "Array" for $Tag, when it should be "The ChronoKeeper".

I also tried Mysql_fetch_object and got a fatal error, could not convert to string.

 

Really confused...

 

2nd Edit-

 

<?php 
$con=mysql_connect('localhost','root','');
mysql_select_db('LolStrat',$con);
$Champion=$_GET['Champion'];
echo $Champion;
$queryone=mysql_query("SELECT Tag FROM champions WHERE Name='$Champion'");
$query_row=mysql_fetch_array($queryone);
echo($query_row[Tag]); 
?>

 

This code generates

 

Zilean
Notice: Use of undefined constant Tag - assumed 'Tag' in C:\wamp\www\LolStrategy\ViewChampion.php on line 30
The ChronoKeeper
  

 

Now If i could just get rid of that notice, i'm done!

 

Any ideas at all?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.