我看过所有类似的主题--我的问题是特定于一组特定的代码。
与php或mysql完全相反,这不是天才。因此,我正在使用一个教程,以建立一个自动画廊与上传系统。
代码排除了各种各样的错误,主要是因为它的语法。我修复了其中的大部分错误--但我在第56行中却遇到了一个错误。
我稍后再重复一遍,因为我无法让<ol>与<code>一起工作
<?php
include 'config.inc.php';
// initialization
$photo_upload_fields = '';
$counter = 1;
// If we want more fields, then use, preupload.php?number_of_fields=20
$number_of_fields = (isset($_GET['number_of_fields'])) ?
(int)($_GET['number_of_fields']) : 5;
// Firstly Lets build the Category List
$result = mysql_query('SELECT category_id,category_name FROM gallery_category');
while($row = mysql_fetch_array($result)) {
$photo_category_list .= <<<__HTML_END
<option value="$row[0]">$row[1]</option>\n
__HTML_END;
}
mysql_free_result( $result );
// Lets build the Image Uploading fields
while($counter <= $number_of_fields) {
$photo_upload_fields .=
<<<__HTML_END
<tr><td>
Photo {$counter}:
<input name="photo_filename[]"
type="file" />
</td></tr>
<tr><td>
Caption:
<textarea name="photo_caption[]" cols="30"
rows="1"></textarea>
</td></tr>
__HTML_END;
$counter++;
}
// Final Output
echo
<<<__HTML_END
<html>
<head>
<title>Lets upload Photos</title>
</head>
<body>
<form enctype="multipart/form-data"
action="upload.php" method="post"
name="upload_form">
<table width="90%" border="0"
align="center" style="width: 90%;">
<tr><td>
Select Category
<select name="category">
$photo_category_list
</select>
</td></tr>
$photo_upload_fields .
<tr><td>
<input type="submit" name="submit"
value="Add Photos" />
</td></tr>
</table>
</form>
</body>
</html>
__HTML_END;
?> 这是$photo_upload_fields .部分,距离底部大约10行。
如果你需要更多细节请告诉我。
提前感谢
发布于 2011-07-12 18:00:20
把它改成
$photo_upload_fields .= <<<__HTML_END而不是。与上一行中的<<<相比,该操作符(<<<)与空格绑定得更紧,因此它被视为语法错误。
https://stackoverflow.com/questions/6668747
复制相似问题