getting value in fk_t_directories

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
zuzupus
Forum Commoner
Posts: 70
Joined: Thu Jul 17, 2003 4:54 am

getting value in fk_t_directories

Post by zuzupus »

function foreach_db($name = 'default') {
global $queries;
if (!$queries[$name]) return False;
$line = mysql_fetch_object($queries[$name][0]);
f (++$queries[$name][1] >= $queries[$name][2]) {
mysql_free_result($queries[$name][0]);
$queries[$name] = False;
}
return $line;
}

actually i dont no how to get value for eg
$names = array();
SELECT u.name,u.sys_pk FROM t_user u INNER JOIN tr_directories_user r ON r.fk_t_user=u.sys_pk WHERE r.fk_t_directories='517' //how i can pass value
thats why i use $r->sys_pk and after this querry

while($r = foreach_db()) {
$names[$r->sys_pk] = $r;
}
please guide me how to pass value through querry

this is the table t_user
CREATE TABLE t_user (
sys_pk int(11) NOT NULL auto_increment,
name text,
fk_t_directories int(11) NOT NULL default '0',
PRIMARY KEY (sys_pk),
KEY Key_fk_t_directories (fk_t_directories)
) TYPE=MyISAM;

INSERT INTO t_user VALUES (12,'acursora',951);
INSERT INTO t_user VALUES (8,'VD',860);
INSERT INTO t_user VALUES (11, 'CAD',99);

CREATE TABLE tr_directories _user(
sys_pk int(11) NOT NULL auto_increment,
fk_t_directories int(11) NOT NULL default '0',
fk_t_user int(11) NOT NULL default '0',
PRIMARY KEY (sys_pk),
UNIQUE KEY fk_t_directories (fk_t_directories,fk_t_user),
KEY Key_fk_t_directories (fk_t_directories),
KEY Key_fk_t_user (fk_t_user))

INSERT INTO t_directories VALUES (12,199,37)
INSERT INTO t_directories VALUES (8,111,11)
INSERT INTO t_directories VALUES (11,69,11)

how i can pass the value in fk_t_directories as i dont want to hard code

i used join qerry so that when i select directories from form i can get user name


hopefully u understand my situation

thanks in advance
zuzupus
Forum Commoner
Posts: 70
Joined: Thu Jul 17, 2003 4:54 am

Re: getting value in fk_t_directories

Post by zuzupus »

nobody is there for my rescue if anybody wants me to get out this trouble i send my entire code

thanks
Post Reply