0

以下代码不起作用,因为页面什么都不显示,我不确定为什么。它从 URL 中获取一些信息,然后从数据库中获取最终专辑名称。这是代码:

<?php
$cart1 = rawurldecode($_GET["path"]);
list( , , , , , $cart2) = explode ("\\", $cart1);
$cart3 = $cart2;
list($cart4) = explode (" ", $cart3);

$con = mysql_connect("SERVER","USER","PASS");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("cartmatch", $con);

$result = mysql_query("SELECT * FROM cartmatch WHERE CARTNO='$cart4'");

while($row = mysql_fetch_array($result))
  {
echo '<form enctype="multipart/form-data" action="albumgo.php" method="POST"><input name="ID" type="hidden" value=';
echo $_GET["ID"];
echo ' ><input name="enabled" type="hidden" value=';
echo $_GET["enabled"];
echo ' ><input name="artist" type="hidden" value=';
echo $_GET["artist"];
echo ' ><input name="title" type="hidden" value="';
echo $_GET["title"];
echo '" >Name:<br/><input name="album" type="text" autofocus="autofocus" value="';
echo $row['ALBUM'];
echo '" ><input type="submit" name="edit" value="Save"></form>';
  }

mysql_close($con);
?>
4

2 回答 2

0

试着把下面的代码放到你的脚本里看看有没有错误。

ini_set('display_errors', 1);
ini_set('log_errors', 1);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
error_reporting(E_ALL);

可能存在数据库连接错误或阻止 PHP 显示其余内容的原因。

于 2012-07-13T21:42:32.437 回答
0
list($cart4) = explode (" ", $cart3);

本来应该

list($cart4) = explode ("+", $cart3);
于 2012-07-13T21:54:49.147 回答