RevCms Author Image ?

Status
Not open for further replies.

Dico

New Member
Nov 14, 2011
7
0
Hey,

How can i show the authorlook by my news?
I am really confused how to do it..
And i think that more people wants to know it..
i hope someone can help.

Sorry for my bad english i am dutch ;)
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,135
2,461
revcms a habbo edit but I only need the php,
the css I can do by myself


If the cms_news table author field uses the username:
PHP:
<?php
$getAuthor = mysql_query("SELECT author FROM cms_news WHERE id='".intval($_GET['id'])."' LIMIT 1");
$author = mysql_result($getAuthor, 0);
 
$getFigure = mysql_query("SELECT figure FROM users WHERE username='".$author."' LIMIT 1");
$figure = mysql_result($getFigure, 0);
 
$authorFigure = "<img src=\"http://www.habbo.com/habbo-imaging/avatarimage?figure=".$figure."&direction=2&head_direction=3&action=crr=6&gesture=sml\">"
?>

If it uses user id:

PHP:
<?php
$getAuthor = mysql_query("SELECT author FROM cms_news WHERE id='".intval($_GET['id'])."' LIMIT 1");
$author = mysql_result($getAuthor, 0);
 
$getFigure = mysql_query("SELECT figure FROM users WHERE id='".$author."' LIMIT 1");
$figure = mysql_result($getFigure, 0);
 
$authorFigure = "<img src=\"http://www.habbo.com/habbo-imaging/avatarimage?figure=".$figure."&direction=2&head_direction=3&action=crr=6&gesture=sml\">"
?>

Simply echo $authorFigure on the place you want it.
 

Dico

New Member
Nov 14, 2011
7
0
If the cms_news table author field uses the username:
PHP:
<?php
$getAuthor = mysql_query("SELECT author FROM cms_news WHERE id='".intval($_GET['id'])."' LIMIT 1");
$author = mysql_result($getAuthor, 0);
 
$getFigure = mysql_query("SELECT figure FROM users WHERE username='".$author."' LIMIT 1");
$figure = mysql_result($getFigure, 0);
 
$authorFigure = "<img src=\"http://www.habbo.com/habbo-imaging/avatarimage?figure=".$figure."&direction=2&head_direction=3&action=crr=6&gesture=sml\">"
?>

If it uses user id:

PHP:
<?php
$getAuthor = mysql_query("SELECT author FROM cms_news WHERE id='".intval($_GET['id'])."' LIMIT 1");
$author = mysql_result($getAuthor, 0);
 
$getFigure = mysql_query("SELECT figure FROM users WHERE id='".$author."' LIMIT 1");
$figure = mysql_result($getFigure, 0);
 
$authorFigure = "<img src=\"http://www.habbo.com/habbo-imaging/avatarimage?figure=".$figure."&direction=2&head_direction=3&action=crr=6&gesture=sml\">"
?>

Simply echo $authorFigure on the place you want it.
Thank you so much!
Both codes give me an error.. :l
Warning: mysql_result() expects parameter 1 to be resource, boolean given... on line 6
Line 6 is: $figure = mysql_result($getFigure, 0);
Any solution for this?
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,135
2,461
My fault, in the query replace figure with look, so change:
PHP:
$getFigure = mysql_query("SELECT figure FROM users WHERE id='".$author."' LIMIT 1");

To
PHP:
$getFigure = mysql_query("SELECT look FROM users WHERE id='".$author."' LIMIT 1");
 
Status
Not open for further replies.

Users who are viewing this thread

Top