Jump to content

Recommended Posts

Posted

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.

 






<?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 .= " $name
";
}

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 .= "$name";
}

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 .= "$name";
}

return $groups_html;
}




?>



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...