将数据存储到变量PHP / MySQL

时间:2015-08-15 05:38:14

标签: php mysql database variables

我想将检索到的数据存储在各个变量中并将其作为SMS发送。在那里你会看到一个'p_contact'数据库字段,它将保存我的电话号码以发送短信。代码如下,只是帮我将这些数据存储到各个变量中:

<table id="highlight" class="sortable noborder" width="950">
                <caption>
                    Manage Marks of Students of 
                    <b><?php echo $database->getColumn(TBL_CLASS, 'class', $class); ?></b>
                </caption>

                <thead>
                <tr>
                    <th>Id</th>
                    <th>Student Code</th>
                    <th>Student Name</th>
                    <?php 
                        $subquery = "SELECT * FROM ".TBL_SUBJECT." WHERE `id` IN(SELECT `subject` FROM ".TBL_SUBJECTCLASS." WHERE `class`='".$class."')";
                        $subresult = $database->query($subquery);
                        while($subrow = mysql_fetch_array($subresult)):
                    ?>
                        <th><?php echo $subrow['subject'];?></th>
                    <?php endwhile; ?>
                </tr>
                <thead>
                    <tbody>
                        <?php 
                            $stdquery = "SELECT * FROM ".TBL_STUDENT." WHERE `classid`='".$class."' ORDER BY `id`";
                            $stdresutl = $database->query($stdquery);
                            while($stdrow=mysql_fetch_array($stdresutl)):
                        ?>
                        <tr class="<?php echo $numrow % 2 == 0 ? 'altRowEven' : 'altRowOdd'; ?>">
                            <td id="center" class="bold">
                                <?php echo $numrow += 1; ?>
                            </td>
                            <td class="bold">
                                <?php echo $stdrow['stdcode']; ?>
                            </td>
                            <td class="bold">
                                <?php echo $stdrow['name']; ?>
                            </td>
                            <?php 
                            $subjquery = "SELECT * FROM ".TBL_SUBJECT." WHERE `id` IN(SELECT `subject` FROM ".TBL_SUBJECTCLASS." WHERE `class`='".$class."')";
                            $subjresult = $database->query($subjquery);
                            while($subjrow = mysql_fetch_array($subjresult)):?>
                            <td id="padding">
                                <?php
                                    $query = "SELECT `marks` FROM ".TBL_MARK." WHERE `subject`='".$subjrow['id']."' and `stdid` = '".$stdrow['id']."'";
                                    $result = $database->query($query);
                                    $value = mysql_fetch_row($result)[0];
                                    echo $value;
                                ?>
                            </td>
                            <?php endwhile?>
                        </tr>
                    <?php endwhile; ?>

0 个答案:

没有答案