SitePoint Sponsor

User Tag List

Page 2 of 3 FirstFirst 123 LastLast
Results 26 to 50 of 71
  1. #26
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    alright. so we're certain its to do with $sub_cat_n

    now, you want to know what your script is assigning $sub_cat_n with right?

    so do this.
    on the page which will be displayed if the query is executed successfully without errors...add this line

    echo "Testing for Variable Content of sub_cat_n = [$sub_cat_n]";

    tell me what you see between the brackets [].
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  2. #27
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nothing just [] !!

  3. #28
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    right. so now you know that $sub_cat_n is not having any value parsed to it.
    i don't know the code which is used to assign the value, so i cna't help you furthur.

    however, we've come to a conclusion that $sub_cat_n variable not having a value is causing the problem.

    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  4. #29
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i made some change with the vars names !
    PHP Code:
    <?
    if ($action  == "renamesubcat") {

    ?>

    <form method="POST" action="<?=$PHP_SELF;?>?action=resubcat">
    <input type="hidden" name="recat" value="1">
    <div align="center">
    <center>
    <table border="0" cellspacing="1" cellpadding="3" class="table_border">
    <tr>
    <td colspan="2" class="header_cell">
    <p align="center">.:: Rename Sub Catagory <font color="#ff6600"><?=$sub_cat;?></font> ::.</p>
    </td>
    </tr>

    <!-- ##################### -->

    <tr>
    <td align="right" class="cells">Name :</td>
    <td class="cells"><input class="box" type="text" name="sub_cat1" size="30" value="<?=$sub_cat;?>"></td>
    </tr>

    <tr>
    <td align="right" class="cells"> Sorting In Catagory :</td>
    <td class="cells">
    <?
    /*
    ##################################
    ##### make Catagory List #########
    ##################################  */
    $sql_cat="select * from catagory";
    $result_cat=@mysql_query($sql_cat,$db);

    echo 
    "

      <select name=\"catagory1\">
      "
    ;
              while(
    $mycat=@mysql_fetch_array($result_cat))
        {
    $catagory_id=$mycat["catagory_id"];
    $catagory=$mycat["catagory"];


      echo
    "<option value=\"$catagory\">$catagory_id . $catagory</option>";
    }
    echo
    "</select>";?>


    </td>
    </tr



    <tr>
    <td colspan="2" class="header_cell">
    <p align="center"><input type="submit" name="submit">
    </td></tr>

    </div>
    </table>
    <?}
    if(
    $action == "resubcat" ){

        if (
    $sub_cat1==""){
            echo 
    "<center><font color=\"#ff0000\"> you must write the new sub catagory name!<br>";
            echo
    "<a href=\"java script:history.back(-1);\">Back</a>";
        }
        else{
    $sql "update subcat set sub_cat='$sub_cat1', catagory='$catagory1' where catagory='$catagory'";
    $resultmysql_query($sql,$db);

            if(!
    $result){
               echo 
    mysql_error();
            }
            else{
                echo
    "<center>Rename sub catagory to<font color=\"#ff6600\"> $sub_cat1</font>, has been done$b</center>";
            }
        }
    }


        
    ?>
    i thing ur talk about [sub_cat1] ! if yes i get the new name of the var.

  5. #30
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so it works now?
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  6. #31
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    NOT yet
    its give back the var. name, but without updtaing !

  7. #32
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Richi
    NOT yet
    its give back the var. name, but without updtaing !
    what do yuo mean?
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  8. #33
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i mean make msg if the update is ok ,that when i sumbit the update i got
    msg with the new $vars. name, check the code :
    PHP Code:
    if($action == "resubcat" ){

        if (
    $sub_cat1==""){
            echo 
    "<center><font color=\"#ff0000\"> you must write the new sub catagory name!<br>";
            echo
    "<a href=\"java script:history.back(-1);\">Back</a>";
        }
        else{
    $sql "update subcat set sub_cat='$sub_cat1', catagory='$catagory1' where sub_cat='$sub_cat'";
    $resultmysql_query($sql,$db);

            if(!
    $result){
               echo 
    mysql_error();
            }
            else{
                echo
    "<center>Rename sub catagory to<font color=\"#ff6600\"> $sub_cat1</font>, has been done$b</center>";
            }
        }

    is it hopless to do it !

  9. #34
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But I want you to check if $sub_cat has a value within it. Not $sub_cat1
    Last edited by lynlimz; Aug 12, 2001 at 01:18.
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  10. #35
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    am do it like this way
    PHP Code:
    echo"<center>Rename sub catagory to<font color=\"#ff6600\"> $sub_cat1</font>, has been done$b</center>";
            } 
    or how can i know ?

  11. #36
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Richi
    am do it like this way
    PHP Code:
    echo"<center>Rename sub catagory to<font color=\"#ff6600\"> $sub_cat1</font>, has been done$b</center>";
            } 
    or how can i know ?
    sorry! i'm getting all mixed up with your variables. i meant $sub_cat

    so what you should do is temporary add the variable to your success text like

    PHP Code:
    echo"<center>Rename sub catagory to<font color=\"#ff6600\"> $sub_cat1</font>, has been done$b [$sub_cat]</center>"
    see if anything is print out between the brackets [].
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  12. #37
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nothing just [] !!

  13. #38
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    okay. so $sub_cat is not having any value. check your code which assigns $sub_cat a value. its that code thats causing the problem.
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  14. #39
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i cann`t find any wrog with the code, can u plz check once more !

    PHP Code:

           #####################################
           #       Adding sub catagory         #
           #####################################
           

    if ($action  == "addsubcat") {

    ?>

    <form method="POST" action="<?=$PHP_SELF;?>?action=newsubcat">
    <input type="hidden" name="cat" value="1">
    <div align="center">
    <center>
    <table border="0" cellspacing="1" cellpadding="3" class="table_border">
    <tr>
    <td colspan="2" class="header_cell">
    <p align="center">.:: Add Sub Catagory ::.</p>
    </td>
    </tr>

    <!-- ##################### -->

    <tr>
    <td align="right" class="cells">Name :</td>
    <td class="cells"><input class="box" type="text" name="subcatname" size="30"></td>
    </tr>

    <tr>
    <td align="right" class="cells"> Sorting In Catagory :</td>
    <td class="cells">
    <?
    /*
    ##################################
    ##### make Catagory List #########
    ##################################  */
    $sql_cat="select * from catagory";
    $result_cat=@mysql_query($sql_cat,$db);

    echo 
    "

      <select name=\"catagory\">
      "
    ;
              while(
    $mycat=@mysql_fetch_array($result_cat))
        {
    $catagory_id=$mycat["catagory_id"];
    $catagory=$mycat["catagory"];


      echo
    "<option value=\"$catagory\">$catagory_id . $catagory</option>";
    }
    echo
    "</select>";?>


    </td>
    </tr



    <tr>
    <td colspan="2" class="header_cell">
    <p align="center"><input type="submit" name="submit">
    </td></tr>

    </div>
    </table>

      <font color="#ff6600"> <? $result mysql_query("select * from subcat");
     
    $num mysql_num_rows($result);
     echo 
    "<br><b>:: The are $num sub catagory now ::</b><br>";?>

     <br>
    <table border="0" cellspacing="1" cellpadding="3" class="table_border">
    <div align="center">
    <tr ><td class="header_cell">ID </td>
    <td class="header_cell"> Name</td>
    <td class="header_cell"> Catagory</td>

    <td class="header_cell">Del Sub</td>


    </tr>

      <?
              $sql_cat
    ="select * from subcat order by sub_cat";
    $result_cat=@mysql_query($sql_cat,$db);

              while(
    $mycat=@mysql_fetch_array($result_cat))
        {
    $sub_cat_id=$mycat["sub_cat_id"];
    $sub_cat=$mycat["sub_cat"];
    $catagory=$mycat["catagory"];


     
    ?>
     <tr><td class="cells">
    <?=$sub_cat_id;?></td><td class="cells">

    <a href="<? echo "$PHP_SELF?action=renamesubcat&sub_cat=$sub_cat"?>">
    <?=$sub_cat;?></a>
    </td>

    <td class="cells">
    <font color="#cef0066"><?=$catagory;?>

    </td>


    </td>
    <td class="cells">
    <a href="<?echo"$PHP_SELF?action=delsubcat&sub_cat=$sub_cat";?>"><img src="del2.gif" border=0 alt="Delete  <?=$sub_cat?>"></a>
        </td>

    </tr>

    <?}}?>
     </center>
    </table>
    </center>
    </div>



    <?         ##############adding new sub catagory function !

    if($action == "newsubcat" && $cat == "1"){
    if (
    $subcatname == ""){
          echo 
    "<center><font color=\"#ff0000\"> you must write the sub catagory name!<br>";
          echo
    "<a href=\"javascript:history.back(-1);\">Back</a>";
      }else {

      
    $query "INSERT INTO subcat (sub_cat, catagory)
     VALUES ('
    $subcatname', '$catagory')";

                
    mysql_query($query$db);


       echo
    "<center>New sub catagory added with name <font color=\"#ff6600\"><b>$subcatname$b</center>";
         }
    }


    ##################### rename SUBCATAGORY !


    if ($action  == "renamesubcat") {

    ?>

    <form method="POST" action="<?=$PHP_SELF;?>?action=resubcat">
    <input type="hidden" name="recat" value="1">
    <div align="center">
    <center>
    <table border="0" cellspacing="1" cellpadding="3" class="table_border">
    <tr>
    <td colspan="2" class="header_cell">
    <p align="center">.:: Rename Sub Catagory <font color="#ff6600"><?=$sub_cat;?></font> ::.</p>
    </td>
    </tr>

    <!-- ##################### -->

    <tr>
    <td align="right" class="cells">Name :</td>
    <td class="cells"><input class="box" type="text" name="sub_cat1" size="30" value="<?=$sub_cat;?>"></td>
    </tr>

    <tr>
    <td align="right" class="cells"> Sorting In Catagory :</td>
    <td class="cells">
    <?
    /*
    ##################################
    ##### make Catagory List #########
    ##################################  */
    $sql_cat="select * from catagory";
    $result_cat=@mysql_query($sql_cat,$db);

    echo 
    "

      <select name=\"catagory1\">
      "
    ;
              while(
    $mycat=@mysql_fetch_array($result_cat))
        {
    $catagory_id=$mycat["catagory_id"];
    $catagory=$mycat["catagory"];


      echo
    "<option value=\"$catagory\">$catagory_id . $catagory</option>";
    }
    echo
    "</select>";?>


    </td>
    </tr



    <tr>
    <td colspan="2" class="header_cell">
    <p align="center"><input type="submit" name="submit">
    </td></tr>

    </div>
    </table>
    <?}

    if(
    $action == "resubcat" )
    {

        if (
    $sub_cat1==""){
            echo 
    "<center><font color=\"#ff0000\"> you must write the new sub catagory name!<br>";
            echo
    "<a href=\"java script:history.back(-1);\">Back</a>";
        }
        else{
    $sql "update subcat set sub_cat='$sub_cat1', catagory='$catagory1' where sub_cat='$sub_cat'";
     
    $result=mysql_query($sql,$db);


                if(!
    $result){
               echo 
    mysql_error();
            }
            else{
                echo
    "<center>Rename sub catagory to<font color=\"#ff6600\"> $sub_cat1$catagory1</font>, has been done[$sub_cat]</$b</center>";
            }
        }
    }


        
    ?>
    Thx For ur time !

  15. #40
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    also when i adding value to sub_cat1 var. nothing happend !

    PHP Code:
            $sub_cat1="cccccccccccccccccccc";
    $sql "update subcat set sub_cat='$sub_cat1', catagory='$catagory1' where sub_cat='$sub_cat'";
     
    $result=mysql_query($sql,$db); 

  16. #41
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try replacing this code

    PHP Code:
    $sql "update subcat set sub_cat='$sub_cat1', catagory='$catagory1' where sub_cat='$sub_cat'";
     
    $result=mysql_query($sql,$db); 
    with this

    PHP Code:
     $result=mysql_query("UPDATE subcat SET sub_cat='$sub_cat1', catagory='$catagory1' WHERE sub_cat='$sub_cat'",$db); 
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  17. #42
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the same thing nothing, just [], and no update !

  18. #43
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    argh. can you direct me as to where $sub_cat is assigned a value?
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  19. #44
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <!-- #####################  HERE IS !-->

    <tr>
    <td align="right" class="cells">Name :</td>
    <td class="cells">



    <input class="box" type="text" name="sub_cat1" size="30" value="<?=$sub_cat;?>">


                                  
    </td>
    </tr>

    <tr>
    <td align="right" class="cells"> Sorting In Catagory :</td>
    <td class="cells">
    <?
    /*
    ##################################
    ##### make Catagory List #########
    ##################################  */

  20. #45
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    as i told , also if i give him the value from the code, nothing happened no update and just [] !

    PHP Code:

     $sub_cat1
    ="222222222222"// adding the sub_cat1 value !

    $sql "update subcat set sub_cat='$sub_cat1', catagory='$catagory1' where sub_cat='$sub_cat'";
    $result mysql_query($sql$db); 

  21. #46
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    am sure the wrong is with the term
    ::: WHERE sub_cat='$sub_cat'" :::

    but i don`t know what is the wrong

  22. #47
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm..there's absolutely nothing wrong with that code!

    and wait! I'M NOT ASKING FOR THE value of sub_cat1

    I want to know the code which assigns a value to sub_cat!
    NOTICE THE VARIABLE WITHOUT THE '1'????
    \
    Pardon me for the uppercase text as this is dragging too long.
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  23. #48
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    am thinking to post the all the file, but it`s over 1400 line !
    so can i send it to via email ?

  24. #49
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alright. send it to me at [removed for anti-spam measures]
    but no guarrentees I can resolve it anytime as i have school during the weekdays.
    Last edited by lynlimz; Aug 12, 2001 at 08:23.
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  25. #50
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by lynlimz

    I want to know the code which assigns a value to sub_cat!
    ok, but i didn`t put any code which assigns value to sub_cat, coz it`s take from sub_cat1 !


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •