Jump to content

Choosing..


Bullet

Recommended Posts

Well basically, i want to equip something but it won't work;

 

//HTML SIDE;

 

$attempts_on_u=mysql_query("SELECT * FROM inventory WHERE username='$username' AND type='House'  ORDER by id DESC");

while($fucker=mysql_fetch_object($attempts_on_u)){

echo "

  <tr>

    <td class=TableArea>House</a></td>

    <td class=TableArea>$fucker->name</td>

          <td class=TableArea>  <a href='?use&id=$fucker->id'>Use</a></td>

        </tr>";

}

 

?>

 

/// CODING;

 

if(($use) && ($id)){

$poo=mysql_query("SELECT * FROM inventory WHERE type='House', id='$id', username='$username'");

$rows=mysql_num_rows($poo);

if($rows == "0"){

print "<p class='warning'>Error. There is no such house please try again.<META HTTP-EQUIV='Refresh' CONTENT='1; URL=Inventory.php'></p>";

}else{

 

$get=mysql_fetch_object(mysql_query("SELECT * FROM inventory WHERE username='$username' AND id=$id' AND type='House'"));

 

mysql_query("UPDATE users SET house='$get->name' WHERE username='$username'");

echo"You are now using $get->name as your house.

<META HTTP-EQUIV='Refresh' CONTENT='1; URL=Inventory.php'>";

}}

Link to comment
https://forums.phpfreaks.com/topic/122569-choosing/
Share on other sites

What's the problem? And what's with your variable names?

 

Also this line:

 

if($rows == "0"){

 

By all rights should be:

 

if($rows == 0){

 

Because mysql_num_rows returns an integer.

 

Thirdly (or is that fourthly?), your code looks an SQL injection attack waiting to happen.

Link to comment
https://forums.phpfreaks.com/topic/122569-choosing/#findComment-632932
Share on other sites

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.