0

error ------->Notice: Undefined variable: result in C:\wamp\www\

<?php
include(db.php);
?>
<table>
<tr>
<td>Select Project:*</td>
<td>
<select name="project_id" id="project_id">
<?php
echo project_name($con);
?>
</select>
</td></tr>
</table>

function project_name($con){
    $select = mysqli_query($con,"select 
    projects.project_id,
    projects.project_name,
    user_proj.user_id,
    user_proj.project_id
    from 
    projects projects,
    users_projects user_proj 
    where 
    projects.project_id = user_proj.project_id and  
    user_proj.user_id ='".$_SESSION['user_id']."'");

while($row = mysqli_fetch_array($select)){
    $result .='<option value="'.$row['project_id'].'">'.$row['project_name'].'</option>';
    }
        return $result;
}

Edited by chaitu11

2
Contributors
2
Replies
6
Views
3 Years
Discussion Span
Last Post by chaitu11
0

Thank you so much...it worked But why should we add this $result = '';

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.