Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Array to Variable

$
0
0

My php code is currently separated from my html, at least as much as possible without using a framework or template system. I am echoing out $result['title'] in my html, is there an easy way to convert it to a variable so I can use $title instead?

 

current html:

<?php foreach ($results as $row): ?>
<?php echo $row['title'] ?> <?php echo $row['description'] ?>
 <?php endforeach; ?>

php:

$results=$conn->query($sql);

Viewing all articles
Browse latest Browse all 13200

Trending Articles