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

Plz Help In Delete/edit/add Values

مغلق
بدأه ausgezeichnete في 22 أكتوبر 2007 · 1 رد · 450 مشاهدة · في منتدى تطوير المواقع بـ PHP
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

This is Value.php

<?php

$conn = mysqli_connect("localhost", "root", "", "cars");
$sql="select id,name from authors";
$authors=mysqli_query($conn,$sql);	
if(!$authors){
echo "Error retrieving author table";
exit();
}else{
echo "Go On!!"."<br />";
}
echo "<table border=1 >";
while($author=mysqli_fetch_array($authors)){
$authorid=$author['id'];
$authorname=$author['name'];
echo "<tr>";
echo "<th>"."$authorname \n"."</th>".
"<td>"."<a href='addauthors.php?id=$authorid'>Add</a>"."<br />"."</td>".
"<td><a href='editauthors.php?id=$authorid'>Edit</a> \n"."</td>".
"<td>"."<a href='deleteauthors.php?id=$authorid'>Delete</a>"."<br />"."</td>";

echo "</tr>";
}
echo "</table>";
?>


this is edit authors.php
كود<?php
if($submit):
$conn = mysqli_connect("localhost", "root", "", "cars");
mysqli_select_db($conn, 'jokes');
$insertsql=mysqli_query("update authors(name) values('$authorname')");
if($insertsql){
echo"inserted ";

}else{
echo "Not inserted";
}
?>
<a href="<?php echo($php_self); ?>" >add another author</a>
<a href="Value.php">Back to author list</a>
<?php else: ?>
<form action="<?php echo($php_self);?>" method=post >
<input type="text" name="name" value="<?php echo($authorname);?>" >
<input type="hidden" name="id" value="<?php echo($authorid);?>" >
<input type="submit" name="submit" value="submit" >
</form>
<?php endif; ?>

this is deleteauthors.php
كود<?php
$conn = mysqli_connect("localhost", "root", "", "cars");

$sql="select id,name from authors";
$authors=mysqli_query($conn,$sql);	
while($author=mysqli_fetch_array($authors)){
$authorid=$author['id'];
$authorname=$author['name'];
}

$ok1=mysqli_query($conn,"delete from jokes where aid=$authorid");
$ok2=mysqli_query($conn, "delete from authors where id=$authorid");
if($ok1 and $ok2){
echo"Author deleted succefully";
}else{
echo "Something wrong";
}
?>
<br />
<a href="Value.php">Back</a>

this is addauthors.php
كود<?php
if($submit):
$conn = mysqli_connect("localhost", "root", "", "cars");
mysqli_select_db($conn, 'jokes');
$insertsql=mysqli_query("insert into authors(name) values('$authorname')");
if($insertsql){
echo"inserted ";

}else{
echo "Not inserted";
}
?>
<a href="<?php echo($php_self); ?>" >add another author</a>
<a href="Value.php">Back to author list</a>
<?php else: ?>
<form action="<?php echo($php_self);?>" method=post >
<input type=text name=name >
<input type=submit name=submit value=submit >
</form>
<?php endif; ?>

and i have this :

إقتباسGo On!!

noha Add

Edit Delete

mona Add

Edit Delete

LEFT TO RIGHT

and when i click add or edit gives me input text and wehn submit nothing happnes

and when i click delete its gives me that

إقتباسSomething wrong

Back

plzzzz help am trying to study php and these problems confuse me

Thnx in advance

#2

تم تنبيهك ولم تنتظر حتى لتقوم بتكرار الموضوع 3 مرات

تم توجيه إنذار لك

Do as I say, not as I do

We are Anonymous. We are Legion. We don't forgive. We don't forget

هذا الموضوع مغلق.

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

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…