Getting info and echoing

Status
Not open for further replies.

JayC

Well-Known Member
Aug 8, 2013
5,505
1,401
Right I have been working on this page but its not getting the information I want from the database..

Code:
<?php
            $t = dbquery("SELECT * FROM users WHERE id = '".USER_ID."' LIMIT 1");
         
            echo '<img style="margin-top: -10px;" src="http://lunar-hotel.com/includes/imager.php?figure=' . $t['look'] . '&size=m">';
            ?>


So the variable T is getting the tables and then I want it to display the look of the character, but the problem is its not :D I am not sure why. I have tried multiple things but this is what it keeps looking like:
jT5EhP9.png

but if I removed ' . $t['look'] . ' and paste the actual code of my look it will work :) Anyone think they can help?
 

Zaka

Programmer
Feb 9, 2012
471
121
Right I have been working on this page but its not getting the information I want from the database..

Code:
<?php
            $t = dbquery("SELECT * FROM users WHERE id = '".USER_ID."' LIMIT 1");
      
            echo '<img style="margin-top: -10px;" src="http://lunar-hotel.com/includes/imager.php?figure=' . $t['look'] . '&size=m">';
            ?>


So the variable T is getting the tables and then I want it to display the look of the character, but the problem is its not :D I am not sure why. I have tried multiple things but this is what it keeps looking like:
jT5EhP9.png

but if I removed ' . $t['look'] . ' and paste the actual code of my look it will work :) Anyone think they can help?
Yeah it should be mysql_query if you are writing the code with mysql_ syntax. Not dbquery. And the user id should be the variable holding the user id.
 

Macemore

Circumcised pineapples
Aug 26, 2011
1,681
819
PHP:
<?php
mysql_connect("MYSQLSERVERHOSTHERE", "MYSQLUSERNAMEHERE", "MYSQLPASSWORDHERE", "MYSQLDATABASEHERE");
$t = mysql_query("SELECT * FROM users WHERE id = '".USER_ID."' LIMIT 1");

echo '<img style="margin-top: -10px;" src="http://lunar-hotel.com/includes/imager.php?figure=' . $t['look'] . '&size=m">';
?>
for mysql_connect you're gunna want the quotes
 

JayC

Well-Known Member
Aug 8, 2013
5,505
1,401
dbquery works too^ I do them both

I have global php it doesn't need to reconnect


Edit:
Now it is telling me Resource ID #
 
Last edited:

Jerry

not rly active lol
Jul 8, 2013
1,957
522
Replace
Code:
SELECT * FROM users WHERE id = '".USER_ID."' LIMIT 1
With
Code:
SELECT * FROM users ORDER BY id DESC LIMIT 1
?
 

Jerry

not rly active lol
Jul 8, 2013
1,957
522
Fixed it,
PHP:
<?php

$getlook = mysql_query("SELECT * FROM users WHERE id = '".USER_ID."' LIMIT 1");
while($t = mysql_fetch_array($getlook)){
echo '<img src="/includes/imager.php?figure=' . $t['look'] . '&size=b&action=sit,wav,crr=667&direction=2&head_direction=3&gesture=sml&size=m" align="middle">';
}
?>
Proof:
7fErEAc.png
 
Status
Not open for further replies.

Users who are viewing this thread

Top