0

This is my code:

<?php
require_once $_SERVER["DOCUMENT_ROOT"] . '/Lol/inc/head.php';

$name = $_POST['name'];

// I think that error is about this next line, but i cant find it

$query = "SELECT * FROM 'heroes' WHERE 'name' = '$name'";
$run =  mysql_query($query);
$row = mysql_fetch_array($run) or die(mysql_error()); 
$id = $row['id'];
$name = $row['name'];
$role = $row['role'];
$srole = $row['srole'];
$atack = $row['atack'];
$health = $row['health'];
$ability = $row['ability'];
$difficulty = $row['difficulty']; 


?>



Name: <?php echo $name; ?><br>
Role: <?php echo $role;?><br>
Secondary Role: <?php echo $srole;?> <br>
Atack: <?php echo $atack;?>/100<br>
Health: <?php echo $health;?>/100<br>
Ability: <?php echo $ability;?>/100<br>
Difficulty: <?php echo $difficulty;?>/100<br>

I created the tables in phpMyAdmin

This is what is shown -- I am running locally in XAMPP.

My website error

Panda
  • 6,955
  • 6
  • 40
  • 55

1 Answers1

0

The problem comes from here

$query = "SELECT * FROM 'heroes' WHERE 'name' = '$name'";

You can't use " ' " on a table name or colums change it to

$query = "SELECT * FROM `heroes` WHERE `name` = '$name'";
Vasil Rashkov
  • 1,818
  • 15
  • 27