SQL表格显示HTML网页中没有换行符

时间:2018-06-01 20:43:37

标签: php html sql

我想在html中显示一段文本(存储在SQL表中)。 我遇到的问题是,当网页上显示所有换行符时,它们都会被删除。

文字如下:
第1天,
这是第一天。
这一天终于完成了。
  
它会显示如下:
第1天,这是第一天。这一天终于完成了。
  

  • 我最初使用'TEXT',但改为'VARCHAR'。
  • 文本已手动插入cpanel中的phpAdmin

代码是

    $result = mysqli_query($conn, "SELECT tablea.id, tableb.id, tablea.name, tablea.surn, tableb.messg, tableb.tdate, tableb.person, FROM tablea INNER JOIN msgs ON tablea.id=tableb.id WHERE id=$id ORDER BY tdate ASC")

or die(mysqli_error($conn));

while($row = mysqli_fetch_array( $result )) {

                ?>

            <div>

                <div>

                    <p>
                        <?php echo strtoupper($row["person"]); ?>
                    </p>

                    <p>
                        <?php echo $row["messg"]; ?>
                    </p>

                    <p>
                        <?php echo $row["tdate"]; ?>
                    </p>

                </div>

            </div>

1 个答案:

答案 0 :(得分:0)

使用 init: function () { var app = Consumer.create({ queueUrl: Settings.getSetting("sendgrid-aws-sqs-queue"), batchSize: 1, visibilityTimeout: 30, waitTimeSeconds: 20, sqs: MarvelAWS.sqs, handleMessage: function (message, done) { try { var msgBody; try { msgBody = JSON.parse(message.Body); } catch (err) { msgBody = null; this._warn("parsing error handling SQS queue " + err, msgBody); } var environment = Settings.getSetting('environment'); if (validateMsg(msgBody) && (environment !== "prod" || this.LIST_TO_ID[msgBody.listId.toString()])) { var userProfile = msgBody.profile, timeSent = msgBody.timeSent, action = msgBody.action, listId = msgBody.listId.toString(), suppressionListId = msgBody.suppressionListId.toString(); _.each(this.actionsMap[action], function (oneAction) { this._debug(oneAction + ':' + listId + ' ' + msgBody.profile.email); sendgridQueueManager.createQueue({ action: oneAction }); sendgridQueueManager.push({ action: oneAction, listId: listId, suppressionListId: suppressionListId, timeSent: timeSent, profile: userProfile }); }.bind(this)); EngineMonitor.countOperation(EngineMonitor.OPS.SENDGRID_SQS_QUEUE_PULL_SUCCESS); } else { this._warn("validation error", msgBody); EngineMonitor.countOperation(EngineMonitor.OPS.SENDGRID_SQS_QUEUE_PULL_ERROR); } done(); } catch (err) { this._warn("error_processing_message " + err); done(new Error('error processing message')); } }.bind(this) }); app.on("message_received", function () { this._debug("message_received"); EngineMonitor.countOperation(EngineMonitor.OPS.SENDGRID_SQS_QUEUE_MESSAGE_RECEIVED); }.bind(this)); app.on("message_processed", function () { this._debug("message_processed"); EngineMonitor.countOperation(EngineMonitor.OPS.SENDGRID_SQS_QUEUE_MESSAGE_PROCESSED); }.bind(this)); app.on("error", function (err, message) { this._warn("message_error " + err + " " + message); EngineMonitor.countOperation(EngineMonitor.OPS.SENDGRID_SQS_QUEUE_PULL_ERROR); }.bind(this)); app.on("processing_error", function (err, message) { this._warn("processing_error " + err); EngineMonitor.countOperation(EngineMonitor.OPS.SENDGRID_SQS_QUEUE_PULL_ERROR); }.bind(this)); app.start(); this._debug('sqs_app_start'); }, 函数将换行符转换为HTML换行符(&lt; br /&gt;)。