04-20-2019, 03:19 PM
This is a sample code of what I mean
<?php
$res = mysqli_query($conn, "SELECT * FROM project_info ORDER BY id DESC $limit");
while ($row = mysqli_fetch_array($res)) {
$pid = $row['id'];
$projectname = $row['project_name'];
$category = $row['category'];
$ownerid = $row['owner'];
$stmt = $db->prepare("SELECT * FROM category WHERE id='$category'");
$stmt->execute();
$row = $stmt->fetch();
$categoryname = $row ['title'];
$stmt = $db->prepare("SELECT * FROM user_info WHERE user_id='$ownerid'");
$stmt->execute();
$row = $stmt->fetch();
$ownername = $row ['full_name'];
?>
<p>
Project name : <?php echo $projectname; ?>
Project category : <?php echo $categoryname; ?>
Project owner : <?php echo $ownername; ?>
</p>
<?php } ?>
Now the above will display projects together with their respective category names and owner names.
So what I need is how to actualize the above using userspice DB function.
<?php
$res = mysqli_query($conn, "SELECT * FROM project_info ORDER BY id DESC $limit");
while ($row = mysqli_fetch_array($res)) {
$pid = $row['id'];
$projectname = $row['project_name'];
$category = $row['category'];
$ownerid = $row['owner'];
$stmt = $db->prepare("SELECT * FROM category WHERE id='$category'");
$stmt->execute();
$row = $stmt->fetch();
$categoryname = $row ['title'];
$stmt = $db->prepare("SELECT * FROM user_info WHERE user_id='$ownerid'");
$stmt->execute();
$row = $stmt->fetch();
$ownername = $row ['full_name'];
?>
<p>
Project name : <?php echo $projectname; ?>
Project category : <?php echo $categoryname; ?>
Project owner : <?php echo $ownername; ?>
</p>
<?php } ?>
Now the above will display projects together with their respective category names and owner names.
So what I need is how to actualize the above using userspice DB function.