page work local but not in server
Posted: Thu Dec 08, 2011 1:07 pm
i do page in php its work fine in wamp.. but it doesnt work in host..
its display all the images that need but not the table with the info, after the line $row = $res->fetch_array(); its not print nothing
this my code:
its display all the images that need but not the table with the info, after the line $row = $res->fetch_array(); its not print nothing
this my code:
Code: Select all
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<link rel="stylesheet" href="menu/menu_style.css" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<style type="text/css">
body{
direction: rtl;
font-family: arial;
color:black;
}
#content{
padding-right:10px;
margin-top:70px;
background: #efefef;
height:500px;
}
</style>
</head>
<body>
<div id="content">
<?php
if(isset($_REQUEST["id"]))
{
$id=$_GET["id"];
echo($id);
echo("<br>");
$strAddress = "Uploaded/";
// Takes all of the files in the specified folder
$arrFileNames = scandir($strAddress);
$arrLength = count($arrFileNames);
$nTemp = 0;
$nCounter = 0;
if($arrLength > 0)
{
echo '<center>';
echo '<table cellpadding="0" cellspacing="15">';
}
foreach($arrFileNames as $strName)
{
// Checks if the current element is a name of a picture
if(($strName!=".") && ($strName!="..") && !strpos($strName, ".txt"))
{
if(strpos($strName,"123321"))
{
$arrpic = explode("123321",$strName);
if($arrpic[0]==$id)
{
// Checks if new line is needed
if($nTemp == 0)
{
echo '<tr>';
}
// Creates a new column and puts an image in it
echo '<td>';
echo '<img src="'.$strAddress.$strName.'" height="100" width="100" />';
echo '<br>';
// Takes only the file name, without the suffix (.jpeg)
$arrId = explode(".",$strName);
// Shows the file content to the user
echo('</td>');
$nTemp++;
if($nTemp == 3)
{
$nTemp = 0;
echo '</tr>';
}
}
}
}
}
if($nTemp != 3 || nTemp != 0)
{
echo '</tr>';
}
$db = new mysqli("localhost","root","","a");
$res = $db->query("SELECT * FROM `carDetails` WHERE `carId` = '".$id."'");
$db->query("SET NAMES 'hebrew'");
$row = $res->fetch_array();
$res->close();
$db->close();
$toWrite = "<h1><font color=\"red\"><b>".$row["carName"]."</h1></font><table>
<tr><td>מחיר:</td><td>".$row["carPrice"]."</td></tr>
<tr><td>קילומטרז:</td><td>".$row["carKm"]."</td></tr>
<tr><td>שנה:</td><td>".$row["carYear"]."</td></tr>
<tr><td>יד:</td><td>".$row["carYad"]."</td></tr>
<tr><td>תיבת הילוכים:</td><td>".$row["carBox"]."</td></tr>
<tr><td>הערות:</td><td>".$row["carOther"]."</td></tr>
</table></b>";
echo($toWrite);
echo("<br/>");
echo("<br/>");
echo ("<a href=\"stocks.php\">");
echo ("חזור למלאי רכבים");
echo("</a>");
}
?>
</div>
</body>
</html>