deshi2003
10-12-2009, 09:59 AM
Please read this thread carefully. you need a few minutes to read it--
i wrote a script like this ::
$rowDetailofBackupCategory=mysql_fetch_assoc(mysql_query("SELECT * FROM category_backup WHERE category_id='$categoryId'"));
$categoryName=$rowDetailofBackupCategory['category_name'];
$categoryDescription=$rowDetailofBackupCategory['category_description'];
$categoryThumbImage=$rowDetailofBackupCategory['category_thumb_image'];
$categoryFullImage=$rowDetailofBackupCategory['category_full_image'];
$mdate=$rowDetailofBackupCategory['mdate'];
$isBrand=$rowDetailofBackupCategory['IsBrand'];
$categoryFromDate=$rowDetailofBackupCategory['category_from_date'];
$categoryUptoDate=$rowDetailofBackupCategory['category_upto_date'];
/*
Retriving data from category_backup i need to update category table so i wrote like --
*/
$approvedEditSql="UPDATE category SET
category_name='$categoryName',
category_description='$categoryDescription',
category_thumb_image='$categoryThumbImage',
category_full_image='$categoryFullImage',
mdate='$mdate',
IsBrand='$isBrand',
category_from_date='$categoryFromDate',
category_upto_date='$categoryUptoDate',
category_publish='Y'
WHERE category_id='$categoryId'";
mysql_query($approvedEditSql) or die("problem hoche");
but in category table only category_publish is updated which value is "Y" and it is a constant value not retrieved from category_backup.no other value is but the rest of field is not updated rather their values are changed to default values.
though i printed all the variable which is found from category_backup is looking ok.(thea is i m getting the value)
When i re write the above code is like that--
$resultOfBackupData=mysql_query("SELECT * FROM category_backup WHERE category_id='$categoryId'");
while($rowDetailofBackupCategory=mysql_fetch_assoc($resultOfBackupData))
{
//$rowDetailofBackupCategory=mysql_fetch_assoc(mysql_query("SELECT * FROM category_backup WHERE category_id='$categoryId'"));
$categoryName=$rowDetailofBackupCategory['category_name'];
$categoryDescription=$rowDetailofBackupCategory['category_description'];
$categoryThumbImage=$rowDetailofBackupCategory['category_thumb_image'];
$categoryFullImage=$rowDetailofBackupCategory['category_full_image'];
$mdate=$rowDetailofBackupCategory['mdate'];
$isBrand=$rowDetailofBackupCategory['IsBrand'];
$categoryFromDate=$rowDetailofBackupCategory['category_from_date'];
$categoryUptoDate=$rowDetailofBackupCategory['category_upto_date'];
$approvedEditSql="UPDATE category SET
category_name='$categoryName',
category_description='$categoryDescription',
category_thumb_image='$categoryThumbImage',
category_full_image='$categoryFullImage',
mdate='$mdate',
IsBrand='$isBrand',
category_from_date='$categoryFromDate',
category_upto_date='$categoryUptoDate',
category_publish='Y'
WHERE category_id='$categoryId'";
mysql_query($approvedEditSql) or die("problem hoche");
Now it is working as expected.
please give me a reasonable cause why this is happening????????? if u can do it then it would be very nice--
i wrote a script like this ::
$rowDetailofBackupCategory=mysql_fetch_assoc(mysql_query("SELECT * FROM category_backup WHERE category_id='$categoryId'"));
$categoryName=$rowDetailofBackupCategory['category_name'];
$categoryDescription=$rowDetailofBackupCategory['category_description'];
$categoryThumbImage=$rowDetailofBackupCategory['category_thumb_image'];
$categoryFullImage=$rowDetailofBackupCategory['category_full_image'];
$mdate=$rowDetailofBackupCategory['mdate'];
$isBrand=$rowDetailofBackupCategory['IsBrand'];
$categoryFromDate=$rowDetailofBackupCategory['category_from_date'];
$categoryUptoDate=$rowDetailofBackupCategory['category_upto_date'];
/*
Retriving data from category_backup i need to update category table so i wrote like --
*/
$approvedEditSql="UPDATE category SET
category_name='$categoryName',
category_description='$categoryDescription',
category_thumb_image='$categoryThumbImage',
category_full_image='$categoryFullImage',
mdate='$mdate',
IsBrand='$isBrand',
category_from_date='$categoryFromDate',
category_upto_date='$categoryUptoDate',
category_publish='Y'
WHERE category_id='$categoryId'";
mysql_query($approvedEditSql) or die("problem hoche");
but in category table only category_publish is updated which value is "Y" and it is a constant value not retrieved from category_backup.no other value is but the rest of field is not updated rather their values are changed to default values.
though i printed all the variable which is found from category_backup is looking ok.(thea is i m getting the value)
When i re write the above code is like that--
$resultOfBackupData=mysql_query("SELECT * FROM category_backup WHERE category_id='$categoryId'");
while($rowDetailofBackupCategory=mysql_fetch_assoc($resultOfBackupData))
{
//$rowDetailofBackupCategory=mysql_fetch_assoc(mysql_query("SELECT * FROM category_backup WHERE category_id='$categoryId'"));
$categoryName=$rowDetailofBackupCategory['category_name'];
$categoryDescription=$rowDetailofBackupCategory['category_description'];
$categoryThumbImage=$rowDetailofBackupCategory['category_thumb_image'];
$categoryFullImage=$rowDetailofBackupCategory['category_full_image'];
$mdate=$rowDetailofBackupCategory['mdate'];
$isBrand=$rowDetailofBackupCategory['IsBrand'];
$categoryFromDate=$rowDetailofBackupCategory['category_from_date'];
$categoryUptoDate=$rowDetailofBackupCategory['category_upto_date'];
$approvedEditSql="UPDATE category SET
category_name='$categoryName',
category_description='$categoryDescription',
category_thumb_image='$categoryThumbImage',
category_full_image='$categoryFullImage',
mdate='$mdate',
IsBrand='$isBrand',
category_from_date='$categoryFromDate',
category_upto_date='$categoryUptoDate',
category_publish='Y'
WHERE category_id='$categoryId'";
mysql_query($approvedEditSql) or die("problem hoche");
Now it is working as expected.
please give me a reasonable cause why this is happening????????? if u can do it then it would be very nice--