将php变量发送到另一个php页面
我需要一些编码方面的帮助。我有一个名为
index.php
和picture.php
的页面。
的index.php
$pid = 0;
for($ctr = 1; $ctr <= 2; $ctr++)
{
echo '<tr>';
$pid++;
echo '<td>';
echo '<a id="various3" href="picture.php" title="try" idno="5"><img src="picture.php" width="150" height="210">';
//echo '<br>'.$pagenm;
echo '</td>';
echo '</td>';
echo '</tr>';
}
执行$pid++
后,我希望将其值发送到picture.php
,以便它可以用于检索查询。
picture.php
$host = 'localhost';
$user = 'root';
$pw = '';
$db = 'thepillar';
mysql_connect($host, $user, $pw);
mysql_select_db($db);
$sql = "select pics, ext from infopics where id='5'";
// mysql_real_escape_string($sql, mysql_connect);
$result = mysql_query($sql) or die('Bad query at 12!' . mysql_error());
while ( $row = mysql_fetch_array($result, MYSQL_ASSOC) ) {
$db_img = $row['pics'];
$type = $row['ext'];
}
$img = base64_decode($db_img); // print_r($db_img );
$img = imagecreatefromstring($img);
header("Content-Type: image/jpeg");
imagejpeg($img);
imagedestroy($img);
我只分配了5作为用于从数据库中检索图像的id。这是因为我不知道如何从index.php
获取$pid
并将其分配给我可以在我的SQL查询中使用的变量。
任何帮助将非常感激。提前致谢。
没有找到相关结果
已邀请:
3 个回复
稀瓣囊
picture.php
亥套惟间连
然后在picture.php中:
乏摩纶誊伟
就这样