Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-22-2009, 02:32 AM
reza01 reza01 is offline
Member
 
Join Date: Jun 2009
Posts: 2
Credits: 979
reza01
Default 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>
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Database functions? Infernette Questions and Supports 8 07-10-2013 12:13 PM
Database SilverDragonTears Questions and Supports 1 11-01-2012 10:33 AM
No tables in database? Fangs Questions and Supports 1 02-28-2012 11:26 AM
Need help with MySQL Database MirandaLK Questions and Supports 13 07-29-2010 09:01 PM
Database help Weretemplar Questions and Supports 20 01-01-2009 03:19 PM


All times are GMT -5. The time now is 02:42 AM.

Currently Active Users: 884 (0 members and 884 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636