Jump to content
php.lv forumi

Mysql select


Wuu

Recommended Posts

	$disable = '';
if (!empty($uSet['disabled_forums'])) {
		$disable = 'where t1.forum_id not in ('.$uSet['disabled_forums'].') ';
}
$result = mysql_query('select t1.tid,t1.title,t1.posts,t1.last_poster_name,t1.starter_name,t2.post from '.$INFO['sql_tbl_prefix'].'topics t1 join '.$INFO['sql_tbl_prefix'].'posts t2 on (t1.tid = t2.topic_id) '.$disable.'group by t1.tid order by t1.last_post desc, t2.post_date desc limit 10;');
if (!empty($result)) {
	$l = 0;
	while ($r = mysql_fetch_array($result)) {
		$u[++$l]['ntopic_id'] = $r[0];
		$u[$l]['ntopic_title'] = $r[1];
		$u[$l]['ntopic_posts'] = $r[2];
		$u[$l]['ntopic_l_name'] = $r[3];
		$u[$l]['ntopic_s_name'] = $r[4];
		$u[$l]['ntopic_post'] = $r[5];
	}
}

 

Vai nav kāda gatava funkcija kas izpildītu

 

			$u[++$l]['ntopic_id'] = $r[0];
		$u[$l]['ntopic_title'] = $r[1];
		$u[$l]['ntopic_posts'] = $r[2];
		$u[$l]['ntopic_l_name'] = $r[3];
		$u[$l]['ntopic_s_name'] = $r[4];
		$u[$l]['ntopic_post'] = $r[5];

 

Nu es domāju savāktu visus myql datus vienā arajā, lai lietotu vēlāk?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...