我到底用这个 php 脚本做错了什么


What the heck am I doing wrong with this php script?

对于我的生活,我无法弄清楚这个脚本出了什么问题。 它只显示一个空白屏幕。 我已经在 joomla 1.5 站点上安装了这个,并在 Jumi 组件中使用此代码。 是代码还是Jumi/Joomla? 任何帮助将不胜感激! 谢谢。

    <html>
    <head>
    <?php

    // RETURN LIST OF DATA ROWS
    function getItems($query) {
        // Initialize variables
                $result = null;
        // Get a reference to the database
                $db = &JFactory::getDBO();
        // Get Current User
                $user = &JFactory::getUser();
            $user_email = $user->email;
        // Set the Query 
    $query ="SELECT *  FROM my_table WHERE owneremail = '$user_email'";
        $num=mysql_numrows($result);
    mysql_close();
    ?>
    </head>
    <body>
    // REPLACE TEMPLATE FIELDS WITH ACTUAL VALUES
    <?php
      $i=0;
      while ($i < $num){
            $f1=mysql_result($result,"firstname");   
            $f2=mysql_result($result,"lastname");
            $f3=mysql_result($result,"street_num");
            $f4=mysql_result($result,"street");
            $f5=mysql_result($result,"apt");
            $f6=mysql_result($result,"city");
            $f7=mysql_result($result,"postcode");
    }
    ?>
<div>
<div style="text-align: center; font-weight: bold; font-size: 14px; font-family: Arial, Helvetica, sans-serif;"><p><strong>Customer Welcome Letter</strong></p>
</div>
'<div style="line-height:15px;"><p><strong>Hello  <?php echo $f1; ?> <?php echo $f2; ?></strong> <br>
<br>
<strong>Here are your details: <span style="border: 1px dashed #CFF; padding-left: 6px; padding-bottom: 3px; padding-right: 3px; padding-top: 3px; background-color: #FFC;"><?php echo $f3; ?> <?php echo $f4; ?> <?php echo $f5; ?> <?php echo $f6; ?>, CO <?php echo $f7; ?></span></strong>(AKA..“<strong>User</strong>”).  </p>
</div>
    <?php
    $i++;
    }
    ?>
</body>
</html>

在函数getItems中,您从未实际执行过 sql 语句$query

这只是一个标准的PHP代码,它发送电子邮件,显然是发送给数据库中的用户。它与Joomla或任何框架无关,因为该脚本仅使用非常标准的基本元素。