Working on my first PHP blog system, I cannot display the result of my query from the page articles.php
include ('config/dbconnect.php');
function selectArticleById( $IdArticle, $c ){
$sqlArticlesId = 'SELECT
artID,
artTitre,
artAuteur,
artContenu,
artDate
FROM articles
WHERE artID =\''.$IdArticle.'\'
';
$result = mysqli_query($c, $sqlArticlesId);
return $result;
}
Calling this function in my menu.inc.php
<?php
$rArticlesId = selectArticleById( $row['artID'], $conn ); ?>
<?php while($row = mysqli_fetch_array($rArticlesId)){ ?>
<ul class="menu">
<li><a href="index.php?page=articleform"><?php echo $row['artTitre']; ?></a></li>
<?php echo $row['artTitre']; ?>
</ul>
<?php } ?>
I get the error : undefined variable row in. SQL injections will be dealt accordingly. I just would like to understand how the function works with 2 variables.