Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/263.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从本地(100%工作)移动到托管时的Bizzare PHP行为。有些代码工作,有些不工作_Php_Mysql_Mamp - Fatal编程技术网

从本地(100%工作)移动到托管时的Bizzare PHP行为。有些代码工作,有些不工作

从本地(100%工作)移动到托管时的Bizzare PHP行为。有些代码工作,有些不工作,php,mysql,mamp,Php,Mysql,Mamp,我一直在用PHP在MacBookPro上本地安装MAMP来构建一个网站。昨天,我终于设法完成了所有工作,所以我决定购买一些Web空间,并使用与MAMP(PHP5.3,MySQL)上的本地安装完全相同的设置来托管文件 当我移动文件并测试站点时,我得到了一个非常奇怪的错误。大多数代码都在工作,但是,代码中有一些部分已损坏,但以一种非常不寻常的方式。我会尽力解释的 注:此图可能很好地显示了错误。我屏蔽了一些私人内容 代码的第一位是: if ($currentpage > $totalpages

我一直在用PHP在MacBookPro上本地安装MAMP来构建一个网站。昨天,我终于设法完成了所有工作,所以我决定购买一些Web空间,并使用与MAMP(PHP5.3,MySQL)上的本地安装完全相同的设置来托管文件

当我移动文件并测试站点时,我得到了一个非常奇怪的错误。大多数代码都在工作,但是,代码中有一些部分已损坏,但以一种非常不寻常的方式。我会尽力解释的

注:此图可能很好地显示了错误。我屏蔽了一些私人内容

代码的第一位是:

if ($currentpage > $totalpages) {
   // set current page to last page
   $currentpage = $totalpages;
} // end if
// if current page is less than first page...
if ($currentpage < 1) {
   // set current page to first page
   $currentpage = 1;
} // end if

// the offset of the list, based on current page 
$offset = ($currentpage - 1) * $rowsperpage;

$sql = "SELECT * FROM message,thumbsup_items WHERE message.id = thumbsup_items.name AND message.date BETWEEN DATE_SUB(NOW(), INTERVAL 7 DAY) AND NOW() ORDER BY votes_down DESC LIMIT $offset, $rowsperpage";
$result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR);
$dest = "http://twitter-badges.s3.amazonaws.com/t_mini-b.png";
$dest2 = "images/fb-small.png";
$url="http://dfwm.ws";
while ($row = mysql_fetch_assoc($result)) 

{

    ?>
我得出的结论是,如果这是一个与运算符有关的错误,就像这两次都发生过的那样,那么它肯定不会显示任何内容,而不是从PHP标记中出来并将其显示为HTML?(图中显示了问题开头的内容)

我真的很想得到一些帮助,因为我已经为此绞尽脑汁好几个小时了


谢谢

您使用的是短标签(
谢谢Martin和Naltharial。我想知道是不是这样,但不确定。
$totalpages) {
   // set current page to last page
   $currentpage = $totalpages;
} // end if
// if current page is less than first page...
if ($currentpage < 1) {
   // set current page to first page
   $currentpage = 1;
} // end if

// the offset of the list, based on current page 
$offset = ($currentpage - 1) * $rowsperpage;

$sql = "SELECT * FROM message,thumbsup_items WHERE message.id = thumbsup_items.name AND message.date BETWEEN DATE_SUB(NOW(), INTERVAL 7 DAY) AND NOW() ORDER BY votes_down DESC LIMIT $offset, $rowsperpage";
$result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR);
$dest = "http://twitter-badges.s3.amazonaws.com/t_mini-b.png";
$dest2 = "images/fb-small.png";
$url="http://dfwm.ws";
while ($row = mysql_fetch_assoc($result)) 

{

    ?>
<?
/******  build the pagination links ******/
// if not on page 1, don't show back links
if ($currentpage > 1) {
   // get previous page num
   $prevpage = $currentpage - 1;
   // show < link to go back to 1 page
   ?>
   <div id = "previous">
   <?
   echo " <a href='?currentpage=$prevpage'>«Previous</a> ";?>
   </div>
   <?

} // end if

// range of num links to show
$range = 2;
?>
<div id="pagination">
<?
// loop to show links to range of pages around current page
for ($x = ($currentpage - $range); $x < (($currentpage + $range)  + 1); $x++) {
   // if it's a valid page number...
   if (($x > 0) && ($x <= $totalpages)) {
      // if we're on current page...
      if ($x == $currentpage) {
         // 'highlight' it but don't make a link
         echo "$x";
      // if not current page...
      } else {
         // make it a link
         echo " <a href='?currentpage=$x'>$x</a> ";
      } // end else
   } // end if 
} // end for
// if not on last page, show forward and last page links        
if ($currentpage != $totalpages) {
   // get next page
   $nextpage = $currentpage + 1;
   ?>
   </div>
   <?
    // echo forward link for next page 
    ?><div id ="next"><?
   echo " <a href='?currentpage=$nextpage'>Next »</a> ";?>
1) {