categories databse table:
id | name
1 | electronics
2 | Automotive
classifieds database table:
id user_id category_id cover title price description
102 1 2 iamges/1.jpg blabla 10 blablabla
I get an error saying: Notice: Undefined variable: name1 in **\post.php on line 49
$id = $_GET['id'];
$res2 = mysql_query("SELECT * FROM `classifieds` WHERE `id` = '" . $id . "' LIMIT 1");
if($res2 && mysql_num_rows($res2) > 0){
while($row = mysql_fetch_assoc($res2)){
$id = $row['id'];
$user_id = $row['user_id'];
$category_id = $row['category_id'];
$price = $row['price'];
$cover = $row['cover'];
$title = $row['title'];
$description = $row['description'];
$profile_data = user_data($user_id, 'username');
$res3 = mysql_query("SELECT * FROM `categories` WHERE `id` = '" . $category_id . "' LIMIT 1");
if($res3 && mysql_num_rows($res3) > 0){
while($row1 = mysql_fetch_assoc($res3)){
$id1 = $row1['id'];
$name = $row1['name'];
}
}
}
}else{
echo 'error';
}echo $name;
why do i get the error for the echo $name1; ?