Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Can Someone Help me about add in database? (http://www.mysidiaadoptables.com/forum/showthread.php?t=943)

reza01 06-22-2009 02:32 AM

Can Someone Help me about add in database?
 
Hello...

We have a program that it works with one row(p1-->group-->sub_group) that it work correctly.
now we want change it. it's output: ($ad_sub_groups).


we want add another row in this program that it will have(p2-->group-->sub_group2).
how we can change it that it works correctly? that it's output be: ($ad_sub_groups).

for guide:
sub_group take this array:
valid_arr[1] = document.newad.sub_group.value;


we want add this variable ($ad_sub_groups2) to our database table.

and we want insert an id in the dataBase tables for each sub_groups.

Code:

<head>
<style type="text/css">
table{FONT-SIZE: 10pt ; FONT-FAMILY: Tahoma}
input{FONT-SIZE: 10pt ; FONT-FAMILY: Tahoma}
select{FONT-SIZE: 10pt ; FONT-FAMILY: Tahoma}
</style>
</head>

<?php
  include("../config.php");
  include("../jdf.php");

  mysql_connect($db_server, $db_username, $db_password);
  mysql_select_db($db_name);

  $authorized = 1;
  if ($authorized)
    {
    $ad_groups = get_groups2();
    $ad_sub_groups = get_sub_groups();
 // $ad_sub_groups2 = ???????????????? i don now how fille it.
    $durations = get_durations();
    }
  else
    header("location:login.php");

  function check_authorization()
  {
    session_start();
    if (isset($_SESSION['uname']) && isset($_SESSION['upass']))
      return true;
    else
      return false;
  }

 function get_groups()
  {
    $query = "SELECT * FROM groups";
    $result = mysql_query($query);

    $groups_html = "";
    while (($row = mysql_fetch_array($result)))   
      {
      $name = $row['Name'];
      $id  = $row['ID'];
      $groups_html .= "<a href=\"../main_group.php?id=$id\"><img src=\%22../images/fbrows4R.gif\">&nbsp;$name</a><br>";
      }

    return $groups_html;
  }

  function get_groups2()
  {
    $query = "SELECT * FROM groups WHERE ParentID=0";
    $result = mysql_query($query);

    $groups_html = "";
    while (($row = mysql_fetch_array($result)))   
      {
      $name = $row['Name'];
      $id  = $row['ID'];
      $groups_html .= "<option value=\"$id\">$name</option>";
      }

    return $groups_html;
  }

  function get_sub_groups()
  {
    $query = "SELECT * FROM groups WHERE ParentID=0";
    $result = mysql_query($query);   
    if (mysql_num_rows($result))
      {
      $row = mysql_fetch_array($result);
      $pid = $row['ID'];
      }

    $query = "SELECT * FROM groups WHERE ParentID=$pid";
    $result = mysql_query($query);

    $groups_html = "";
    while (($row = mysql_fetch_array($result)))   
      {
      $name = $row['Name'];
      $id  = $row['ID'];
      $groups_html .= "<option value=\"$id\">$name</option>";
      }

    return $groups_html;
  }

 

 
?>

<script type="text/javascript">

  function get_sub_groups(group)
  {
    document.newad.sub_group.options.length = 0;
    jsel = document.createElement('script');
    jsel.type = "text/javascript";
    jsel.src = "get_sub_groups.php?grp=" + group;
    document.body.appendChild(jsel);
  }


  function validate()
  {
    valid_arr = new Array(3);

    valid_arr[0]  = document.newad.group.value;
    valid_arr[1]  = document.newad.sub_group.value;
    valid_arr[2]  = document.newad.sub_group2.value;
 
 for (i=0; i<3; i++)
      if (valid_arr[i] == "")
        {
        isvalid = false;
        alert("erroe.");
        return false;
        }

    return true;
  }

</script>

                                </body>

                                <table style="width: 100%">
                                        <tr>
                                                <td style="width: 121px">
                &nbsp;</td>
                                                <td style="width: 1384px">
                &nbsp;</td>
                                        </tr>
                                        <tr>
                <span lang="en-us">
                                                <td style="width: 121px" class="style13"><strong>
                                                <span lang="en-us">p</span>
                                                1</strong></td>
                </span>
                                                <td style="width: 1384px">
                <span lang="en-us">
                                                &nbsp;&nbsp;&nbsp;
                                                        <input type="text" style="width: 50px" name="title" size="20">
                group:&nbsp;
                                                        <select name="group" onchange="get_sub_groups(this.value)">
                                                                <?php echo $ad_groups; ?>
                                                        </select>&nbsp;sub_group:
                                                        <select name="sub_group">
                                                                <?php echo $ad_sub_groups; ?>
                                                        </select></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                </td>
                                        </tr>
                <span lang="en-us">
                                        <tr>
                                                <td style="width: 121px" class="style14"><strong>
                                                <span lang="en-us">p</span>
                                                2</strong></td>
                                                <td style="width: 1384px">
                <span lang="en-us">
                                                &nbsp;</span>&nbsp;&nbsp; <span lang="en-us">
                                                        <input type="text" style="width: 50px" name="title2" size="20">
                group:&nbsp;
                                                        <select name="group0" onchange="get_sub_groups(this.value)">
                                                                <?php echo $ad_groups; ?>
                                                        </select>&nbsp;sub_group:
                                                        <select name="sub_group0">
                                                                <?php echo $ad_sub_groups; ?>
                                                        </select></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
                                                        &nbsp;</table>
                </span></html>


BMR777 06-22-2009 11:54 AM

RE: Can Someone Help me about add in database?
 
What program's code do you keep posting here? This code is NOT from any of our products and thus is not supported here.


All times are GMT -5. The time now is 09:48 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.