$_REQUEST mysql_query PHP
-
Friends, help me figure this out.
There's a NAME OBD. It has two pillars: name1 and name2♪
I need to make a column point. name2provided in this linename1 = $SuperName=$_REQUEST['name']
♪$_REQUEST['name']
Transmitted correctly (I try to separate the line and put it in $data).Next, my code:
$Подключение к БД $SuperName=$_REQUEST['name']; $sql= mysql_query("SELECT * FROM NAME WHERE name1='$SuperName' ",$db); if($sql) {
while($data = mysql_fetch_array($sql)) { echo $data['name2']; }
}
else
{
print mysql_error();
}
On the way out, he's making a mistake that Name2 isn't defined.
This may be an unrealistic simple question, but I don't understand what's wrong. I honestly read the same questions. I don't know what's wrong.
-
Replace.
mysql_fetch_array
♪mysql_fetch_assoc
Since in the first case you will receive a list (massium with 0.1.2.3) and in the second case, an associated mass (name 1, name2)