الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

مشكلة في عرض البيانات

بدأه توشيبا في 2 أبريل 2011 · 4 رد · 484 مشاهدة · في منتدى تطوير المواقع بـ PHP
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

لو سمحتوا انا عندي جدول يحوي مجموعة من المتغيرات

وانا راح اعرض الرقم والوصف في صفحة ويكون بجانب كل رقم ووصف كلمة عرض وحذف

المفروض اذا ضغط على عرض تطلع له باقي البيانات الخاصة بها الرقم واذا ضغط حذف تنحذف من قاعدة البيانات

بالنسبة للصفحة اللي بيصير فيها الرقم والوصف تشتغل معي تمام

واذا اختار حذف تنحذف بدون اي مشاكل

المشكلة عندي اذا اختار عرض ماتطلع له اي قيمة من قاعدة البيانات مدري وين المشكلة

وهذا الكود الصفحة اللي راح يطلع منها الرقم والوصف

<!DOCTYPE HTML SYSTEM>
<html dir=rtl>
<head>
<title>الشكوى </title>
</head>
<body>
<div>

<form name = "com" method ="POST">
<?
$connect=mysql_connect("localhost","root","");

mysql_select_db("b");
mysql_query("set names 'utf8'");
$sq= mysql_query("select Sn,Com_description  from com");
echo "<table width=\"400\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\">"; 
while($mysqlf= mysql_fetch_array($sq))
{
$sn=$mysqlf['Sn'];
$com_description=$mysqlf['Com_description'];
echo "<tr  bgcolor=\"#CCCCCC\"><td colspan = \"4\" >$sn</td><td>" ?><a href ="veiwjj.php"> عرض </a>
<?  echo "<td>" ?><a href="deletco.php?Sn=<?php echo $sn; ?>">حذف</a>
<? echo "</td></tr>";
echo "<tr><td colspan =\"6\" >$com_description</td><td>";
echo "</table>";
echo "<table width=\"400\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\">";
}
echo "</table>";

?>

</div>
</body>
</html>

وهنا كود صفحة veiwjj والمفروض تطلع كل البيانات الخاصة بالرقم اللي بيختاره من قاعدة البيانات وطبعا مايطلع لي اي شي

<!DOCTYPE HTML SYSTEM>
<html dir=rtl>
<head>
<title></title>
</head>
<body>

<?
$ssn=$_POST['$sn'];
$connect=mysql_connect("localhost","root","");
mysql_select_db("b");
echo $sn;
mysql_query("set names 'utf8'");
$sq= mysql_query("select * from com where Sn ='$ssn'");

echo "<table width=\"400\" border=\"2\" cellpadding=\"0\" cellspacing=\"1\">";
echo "<tr>";
echo "<th align=\"center\" width=\"78\" bgcolor=\"#CCCCCC\">";
echo "الرقم";
echo "</th>";
echo "<th>";
echo $sq['Sn'];
echo "</th>";
echo "</tr>";

echo "<tr>";
echo "<th align=\"center\"  width=\"78\" bgcolor=\"#CCCCCC\">";
echo "الاسم";
echo "</th>";
echo "<th>";
echo $sq['$Fname_com'];
echo $sq['$Mname_com'];
echo $sq['$Lname_com'];
echo "</th>";
echo "</tr>";



echo "<tr>";
echo "<th align=\"center\" width=\"78\" bgcolor=\"#CCCCCC\">";
echo "رقم الهاتف";
echo "</th>";
echo "<th>";
echo $sq['Tel_num'];
echo "</th>";
echo "</tr>";



echo "<tr>";
echo "<th align=\"center\" width=\"78\" bgcolor=\"#CCCCCC\">";
echo "الوصف";
echo "</th>";
echo "<th>";
echo $sq['$Com_description'];
echo "</th>";
echo "</tr>";


echo "<tr>";
echo "<th align=\"center\"  width=\"78\" bgcolor=\"#CCCCCC\">";
echo "الحالة";
echo "</th>";
echo "<th >";
echo $sq['state'];
echo "</th>";
echo "</tr>";




echo "<tr>";
echo "<th align=\"center\" width=\"78\" bgcolor=\"#CCCCCC\">";
echo "الحل";
echo "</th>";
echo "<th>";
echo $sq['Solve_description'];
echo "</th>";
echo "</tr>";


mysql_close($connect);?>


<a href = "deletco.php">حذف</a>
<a href = "updatej.php">تعديل</a>

</form>
</body>
</html>
#2

صحح السطور التالية

<a href ="veiwjj.php?sn=<?php echo $sn; ?>"> عرض </a>

في الملف viewjj.php

$ssn=$_GET['sn'];
#3

طيب اخوي سويت مثل ماقلت في الكود الاول

وفي كود veiwjj سويت بعد مثل ماقلت

لكن ماطلعت البيانات

وحتى اتأكد انه اخذ القيمة سويت echo $ssn;

وطلع معي الرقم لكن القيم ماتطلع ماادري المشكلة في الاستعلام

وهذا الكود بعد التعديل

<!DOCTYPE HTML SYSTEM>
<html dir=rtl>
<head>
<title></title>
</head>
<body>

<?
$ssn=$_GET['Sn'];
echo $ssn;
$connect=mysql_connect("localhost","root","");
mysql_select_db("b");
mysql_query("set names 'utf8'");
$sq= mysql_query("select * from com where Sn ='$ssn'");
echo "<table width=\"400\" border=\"2\" cellpadding=\"0\" cellspacing=\"1\">";
echo "<tr>";
echo "<th align=\"center\" width=\"78\" bgcolor=\"#CCCCCC\">";
echo "الرقم";
echo "</th>";
echo "<th>";
echo $sq['Sn'];
echo "</th>";
echo "</tr>";

echo "<tr>";
echo "<th align=\"center\"  width=\"78\" bgcolor=\"#CCCCCC\">";
echo "الاسم";
echo "</th>";
echo "<th>";
echo $sq['$Fname_com'];
echo $sq['$Mname_com'];
echo $sq['$Lname_com'];
echo "</th>";
echo "</tr>";


echo "<tr>";
echo "<th align=\"center\" width=\"78\" bgcolor=\"#CCCCCC\">";
echo "رقم الهاتف";
echo "</th>";
echo "<th>";
echo $sq['Tel_num'];
echo "</th>";
echo "</tr>";



echo "<tr>";
echo "<th align=\"center\" width=\"78\" bgcolor=\"#CCCCCC\">";
echo "الوصف";
echo "</th>";
echo "<th>";
echo $sq['$Com_description'];
echo "</th>";
echo "</tr>";




echo "<tr>";
echo "<th align=\"center\"  width=\"78\" bgcolor=\"#CCCCCC\">";
echo "الحالة";
echo "</th>";
echo "<th >";
echo $sq['state'];
echo "</th>";
echo "</tr>";


echo "<tr>";
echo "<th align=\"center\" width=\"78\" bgcolor=\"#CCCCCC\">";
echo "الحل";
echo "</th>";
echo "<th>";
echo $sq['Solve_description'];
echo "</th>";
echo "</tr>";

mysql_close($connect);?>


<a href = "deletco.php">حذف</a>
<a href = "updatej.php">تعديل</a>

</form>
</body>
</html>
#4

في phpveiwjj.php ايضا يجب استعمال

while($mysqlf= mysql_fetch_array($sq))

تم تعديل هذه المشاركة بواسطة choclatboy في 2 أبريل 2011 في 21:53

#5

الحمد لله مشى تمام

ثانكس

مواضيع مشابهة