将OO转换为程序

Been a while since I last posted here, but I need some help!

First, I am creating a messaging system and I copied it from a tutorial (I like to copy code to use and study) but it's in what I believe is Object Orientated version (correct me if I'm wrong). I only use the procedural version, none of those "->" or anything. How can I convert this into procedural?

$grab_pm = mysqli_query($con,"SELECT * FROM `pms` WHERE `touser` = '$touser' AND `id` = '$id'");

while($r= mysqli_fetch_object($grab_pm)) {


echo "<h2>$r->subject</h2>";
echo "<p>$r->message</p>";
echo "<p>From: $r->fromuser ";
echo "<p>On: $r->datesent</p>";

Thanks!

I see it is just changing to this

while($r= mysqli_fetch_array($grab_pm)) {
$subject = $r['subject'];
$message = $r['message'];
$fromuser = $r['fromuser'];
$datesent = $r['datesent'];

echo "<h2>$subject</h2>";
echo "<p>$message</p>";
echo "<p>From: $fromuser ";
echo "<p>On: $datesent</p>";

Fetch associative array instead of object:

$grab_pm = mysqli_query($con,"SELECT * FROM `pms` WHERE `touser` = '$touser' AND `id` = '$id'");

while($r= mysqli_fetch_assoc($grab_pm)) {

   echo "<h2>$r['subject']</h2>";
   echo "<p>$r['message']</p>";
   echo "<p>From: $r['fromuser'] ";
   echo "<p>On: $r['datesent']</p>";
}

But I still highly suggest you learn a thing or two about OOP, even though you think it's an obsolete non-sence :)