How do I display a table

Proximity

IDK?
Feb 13, 2014
673
56
How can I grab the contents of a database table and display it on the page?

Like SELECT look FROM users WHERE username = '" . filter( $_GET['username'] ) . "'" ) or die( mysql_error() and than display the look
 

Joel

Aspiring Developer
Mar 30, 2014
100
30
Try doing something like this:
Code:
<img src="{INSERT HABBO IMAGING LINK}
<?php

mysql_query('SELECT look FROM users WHERE username = '" . filter( $_GET['username'] ) . "'" ') or die( mysql_error()

?>
.png">

make sure the habbo imaging link is like: without the brackets.
 

Proximity

IDK?
Feb 13, 2014
673
56
I assume you want this done in PHP, like a pleb?

Yes
Try doing something like this:
Code:
<img src="{INSERT HABBO IMAGING LINK}
<?php

mysql_query('SELECT look FROM users WHERE username = '" . filter( $_GET['username'] ) . "'" ') or die( mysql_error()

?>
.png">

make sure the habbo imaging link is like: without the brackets.

?
 

TesoMayn

Boredom, it vexes me.
Oct 30, 2011
1,482
1,482
PHP:
$data = new mysqli('localhost', 'username', 'password', 'database');
if ($data->connect_error) { die("Connection failed: " . $data->connect_error); }
$username = $data->real_escape_string($_GET['username']);
$exe = $data->query("SELECT look FROM users WHERE username = '$username'");
if ($exe->num_rows > 0) {
  while($row = $exe->fetch_assoc()) {
    print "<img src=\"http://example.com/avatar.php?user={$username}\">";
  }
} else {
  echo 'Username not found';
}
$data->close();

You're welcome
 

Proximity

IDK?
Feb 13, 2014
673
56
[26-Nov-2015 03:09:00 Europe/Belgrade] PHP Parse error: syntax error, unexpected '"' in C:\inetpub\wwwroot\avatarimage.php on line 11
 
[26-Nov-2015 03:09:00 Europe/Belgrade] PHP Parse error: syntax error, unexpected '"' in C:\inetpub\wwwroot\avatarimage.php on line 11
@Joel
 
@TesoMayn it deosn't show the avatar...
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,135
2,461
Replace
PHP:
print "<img src=\"http://example.com/avatar.php?user={$username}\">";
with
PHP:
print "<img src=\"http://habbo.nl/habbo-imaging/avatarimage?figure={$row['look']}\">";
 

Proximity

IDK?
Feb 13, 2014
673
56
OMG thank you @Exalted Close thread please.@Mods
 
PHP:
$data = new mysqli('localhost', 'username', 'password', 'database');
if ($data->connect_error) { die("Connection failed: " . $data->connect_error); }
$username = $data->real_escape_string($_GET['username']);
$exe = $data->query("SELECT look FROM users WHERE username = '$username'");
if ($exe->num_rows > 0) {
  while($row = $exe->fetch_assoc()) {
    print "<img src=\"http://example.com/avatar.php?user={$username}\">";
  }
} else {
  echo 'Username not found';
}
$data->close();

You're welcome

Replace
PHP:
print "<img src=\"http://example.com/avatar.php?user={$username}\">";
with
PHP:
print "<img src=\"http://habbo.nl/habbo-imaging/avatarimage?figure={$row['look']}\">";

Thank you. You two are the best.
 

BIOS

ಠ‿ಠ
Apr 25, 2012
906
247
If you're using MySQLi, why not make use of prepared statements rather than throwing raw variables into the query? You're throwing away possibly one of the best features of it...
 

Users who are viewing this thread

Top