简体   繁体   English

注意:未定义的索引:第164行的C:\\ wamp \\ www \\ blog \\ news.php中的pre

[英]Notice: Undefined index: pre in C:\wamp\www\blog\news.php on line 164

I am making a blog for myself in Dreamweaver and well I have run into some trouble, I want to display text from a database and yet it won't work for some reason. 我在Dreamweaver中为自己创建了一个博客,但是遇到一些麻烦,我想显示数据库中的文本,但是由于某些原因它无法正常工作。 I keep getting this error: 我不断收到此错误:

Notice: Undefined index: pre in C:\\wamp\\www\\blog\\news.php on line 164 This is the block of code where the error is: 注意:未定义的索引:第164行的C:\\ wamp \\ www \\ blog \\ news.php中的pre这是代码块,其中的错误是:

  <div id="blog_posts">
<?php do { ?>
  <h2><?php echo $row_getDisplay['title']; ?></h2>
  <p class="updated"><?php echo $row_getDisplay['formatted']; ?></p>
  <p><?php echo $row_getDisplay['pre']; ?></p>
  <?php } while ($row_getDisplay = mysql_fetch_assoc($getDisplay)); ?>

Can anyone please help? 谁能帮忙吗? I have been trying for days! 我已经尝试了好几天了!

使用while(...) { }循环而不是do { } while(...)循环,这样$row_getDisplay会在第一次迭代时初始化。

In your array there are not index 'pre'... 在您的数组中没有索引'pre'...

You can use 您可以使用

echo isset($row_getDisplay['pre'])?$row_getDisplay['pre']:'';

for using your code with incorrect index. 使用错误索引的代码。

PHP indicating the problem is that there index "pre". PHP指出问题在于索引“ pre”。 Try to make an inspection of the variable $ row_getDisplay using var_dump() (http://www.php.net/manual/en/function.var-dump.php). 尝试使用var_dump()(http://www.php.net/manual/en/function.var-dump.php)检查变量$ row_getDisplay。 With this function you can check if the "pre" exists in the array of fields. 使用此功能,您可以检查字段数组中是否存在“ pre”。

<div id="blog_posts">
<?php do { ?>
<?php var_dump($row_getDisplay); ?>
  <h2><?php echo $row_getDisplay['title']; ?></h2>
  <p class="updated"><?php echo $row_getDisplay['formatted']; ?></p>
  <p><?php echo $row_getDisplay['pre']; ?></p>
  <?php } while ($row_getDisplay = mysql_fetch_assoc($getDisplay)); ?>

Regards!. 问候!。

只需检查数组的内容,然后回显"<pre>",print_r($row_getDisplay, TRUE),"</pre>"以便可以查看其内容,里面可能没有pre index pre

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 注意:未定义的索引:第63行的C:\\ wamp \\ www \\ chatsystem \\ index.php中的名称 - Notice: Undefined index: name in C:\wamp\www\chatsystem\index.php on line 63 注意:未定义的索引:在第37行的C:\\ wamp \\ www \\ tests \\ Joomla \\ Website \\ index.php中 - Notice: Undefined index: in C:\wamp\www\tests\Joomla\Website\index.php on line 37 注意:未定义的变量:第7行的C:\\ wamp \\ www \\ cbmall \\ index.php中的db_host - Notice: Undefined variable: db_host in C:\wamp\www\cbmall\index.php on line 7 注意:未定义的索引:第46行的C:\\ wamp \\ www \\ upload.php中的fileToUpload - Notice: Undefined index: fileToUpload in C:\wamp\www\upload.php on line 46 我有错误:注意:未定义偏移量:C:\\ wamp \\ www \\ index.php在32行,34行,36行,38行的C:\\ wamp \\ www \\ index.php中 - I have error:Notice: Undefined offset: 1 in C:\wamp\www\index.php on line 32,on line 34,on line 36,on line 38 PHP错误提示:未定义的索引:第35行的C:\\ wamp \\ www \\ tweetball \\ classes \\ word.class.php中的UserID - Php error Notice: Undefined index: UserID in C:\wamp\www\tweetball\classes\word.class.php on line 35 复选框值未获取-&gt;注意:未定义的索引:第27行的C:\\ wamp \\ www \\ crud_exer1 \\ content.php中的name1 - checkbox value not get -> Notice: Undefined index: name1 in C:\wamp\www\crud_exer1\content.php on line 27 未定义索引:在第 4 行输入 C:\\wamp\\www\\submit.php - Undefined index: type in C:\wamp\www\submit.php on line 4 未定义索引:第 4 行 C:\wamp\www\emailvalidate.php 中的电子邮件 - Undefined index: email in C:\wamp\www\emailvalidate.php on line 4 注意:未定义的索引:第16行的F:\\ wamp64 \\ www \\ practise \\ insert.php中的用户名 - Notice: Undefined index: username in F:\wamp64\www\practise\insert.php on line 16
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM