PDA

View Full Version : فراخوانی اطلاعات ازپایگاه



زینب فاطمی
یک شنبه 17 مهر 1390, 18:38 عصر
باسلام
من دریک صفحه id را بامتد get به صفحه دیگرپاس دادم ودرآنجا به پایگاه مراجعه کردم واطلاعات مربوط به این id را فراخوانی کردم تا اطلاعاتش را توسط ادیتور ویرایش کنم ولی وقتی صفحه دوم را می آورم با اینکه درقسمت آدرس شماره id دیده می شود ولی این پیام را می بینم که :Notice: Undefined variable: row in وخطی را هم که اشکال می گیرد این است :
$oFCKeditor->Value =$row['title_news'] ; ولی من قبلش این title_news را فراخوانی کردم .

Arthas1990
یک شنبه 17 مهر 1390, 23:25 عصر
$row رو print_r کن ببین خروجیت اصلا درسته یا نه . ظاهرا زمانی که id رو چاس میدی در کوئریت مشکلیهست . کوری رو بذار تا بچه ها بهت کمک کنن

Arthas1990
یک شنبه 17 مهر 1390, 23:27 عصر
$row رو print_r کن ببین خروجیت اصلا درسته یا نه . ظاهرا زمانی که id رو چاس میدی در کوئریت مشکلی هست . کوری رو بذار تا بچه ها بهت کمک کنن

زینب فاطمی
دوشنبه 18 مهر 1390, 16:00 عصر
سلام
این کدهای صفحه دوم که مشکل داره :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<TITLE>مدیریت سایت</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="MSHTML 6.00.3790.3959" name=GENERATOR>
<link href="../css.css" rel="stylesheet" type="text/css">
<script type="text/javascript" language="JavaScript1.2" src="../fckeditor/fckeditor.js"></script>
</HEAD>
<BODY >
<?php
include_once('../fckeditor/fckeditor.php') ;
?>
<?
$id=$_GET['id'];

$link=mysql_connect('localhost','root','');
if(!$link)
{ die("couldn't connect to my sql");};
mysql_select_db('meshkat',$link) or die("couldn't connect to db");
$result = mysql_query("SELECT * FROM news where id=$id");
$row = mysql_fetch_array($result);
?>
<a href="form_news2.php" class="topmenu">ورود خبر</a> --- <a href="index.php" class="topmenu">لیست اخبار</a>
<a href="../index_in2.php"><img src="../1_files/home.gif" width="72" height="78" border="0"></a><a href="../index.php"><img height=78
alt=Logout src="../1_files/IMG_SKIN_NAV_LOGOUT.gif"
width=93 border=0
name=navlogout></a><div align="center" class="title">
<form action="edit_news.php" method="post" enctype="multipart/form-data">

<p class="title">بخش اخبار</p>
<p class="topmenu">ويرايش اخبار </p>
</div> <div align="right">

<input name="title_news" type="text" class="info_input" id="title_news" value="<? print $row['title_news']?>" size="50" >
</div>
<div align="right"><span class="info">عنوان خبر </span></div>
<div align="right">
<input name="text_news" type="text" class="info_input" id="text_news" value="<? print $row['text_news']?>" size="50">
</div><div align="right">منبع</div>
<div align="right">
<input name="pic1" type="hidden" id="pic1" value="<? print $row['pic']?>">
<input name="pic" type="file" class="info_input" id="pic" size="25">
</div><img src="../../images/khabar/<? print $row['pic']?>">
<div align="right">عكس</div>
<div align="right">
<input name="pic21" type="hidden" id="pic21" value="<? print $row['pic2']?>">
<input name="pic2" type="file" class="info_input" id="pic2" size="25">
</div><img src="../../images/khabar/<? print $row['pic2']?>">
<div align="right">عكس داخلي </div>
<div align="right">
<input name="year" type="text" id="year" value="<? print $row['year']?>" size="4" maxlength="4">
<span class="topmenu">سال</span>
<span class="info">
<input name="month" type="text" id="month" value="<? print $row['month']?>" size="4" maxlength="4">
</span><span class="topmenu">ماه</span>
<input name="day" type="text" id="day" value="<? print $row['day']?>" size="4" maxlength="4">
<span class="topmenu">روز</span></div>
<div align="right">تاريخ</div>
<div align="right">
<input name="time" type="text" id="time" value="<? print $row['time']?>" size="8" maxlength="8">
<?php };?>
</div><div align="right">زمان</div>
<div align="right"></div>
<div align="right">عنوان خبر </div>
<div align="right">
<?php
$oFCKeditor = new FCKeditor('title_news') ;
$oFCKeditor->BasePath = '../fckeditor/' ;
$oFCKeditor->Value =$row['title_news'] ;
$oFCKeditor->Create() ;
?>
</div>
<div align="right">متن خبر</div>
<div align="right">
<?php
$oFCKeditor = new FCKeditor('text_news') ;
$oFCKeditor->BasePath = '../fckeditor/' ;
$oFCKeditor->Value =$row['text-news'] ;
$oFCKeditor->Create() ;
?>
</div>
<input name="id" type="hidden" id="id" value="<? print $row['id']?>">
<input type="submit" name="Submit" value="ثبت">
</form>

</div>
<? require_once('../menu.inc.php');?>
</BODY></HTML>

blackmak
دوشنبه 18 مهر 1390, 21:37 عصر
اینو بزار ببین جواب میده ؟

$result = mysql_query("SELECT * FROM news where id='$id' ");

زینب فاطمی
دوشنبه 18 مهر 1390, 22:28 عصر
نه درست نشدوبازم به
$oFCKeditor->Value =$row['title_news'] ; و
$oFCKeditor->Value =$row['text-news'] ; ایراد میگیره .

زینب فاطمی
پنج شنبه 21 مهر 1390, 14:35 عصر
کسی نمی تونه کمک کنه؟

Arthas1990
چهارشنبه 27 مهر 1390, 05:54 صبح
$row رو در خط 22 print_r($row); کن و خروجی رو بزار تا ببینیم اصلا همچین رکورز هایی رو داری یا نه و خروجی db چیه .

tux-world
چهارشنبه 27 مهر 1390, 09:50 صبح
اون کوئری رو اول یه اینصورت اصلاحش کن:

$result = mysql_query("SELECT * FROM news where id='."$id".' ");
در ضمن به جای ستاره بهتره فیلدهای دیتابیسیتو بنویسی در غیراینصورت از شماره ۰ که معرفی میشه استفاده کنی راحت تری ولی سعی کن اسم فیلدها رو بنویسی تو کوئریت