Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
grudz
Forum Commoner
Posts: 68 Joined: Thu Dec 04, 2003 12:52 pm
Post
by grudz » Fri Dec 05, 2003 10:28 am
here is my code
Code: Select all
$query_forum = "SELECT DISTINCT question_title FROM forum ORDER BY `date` DESC";
basically, this makes the users see on the php page the different info from the 'qustion_title' column. thats exactly what i wanted, but on this page, i also have different columns from that table that i want to show, not just 'question_title'
how do i keep this code, but write that i also want the other columns
thank you in advance
Weirdan
Moderator
Posts: 5978 Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine
Post
by Weirdan » Fri Dec 05, 2003 10:30 am
Code: Select all
$query_forum = "SELECT DISTINCT question_title, other_column, some_other_column FROM forum ORDER BY `date` DESC";
Huh?
grudz
Forum Commoner
Posts: 68 Joined: Thu Dec 04, 2003 12:52 pm
Post
by grudz » Fri Dec 05, 2003 10:40 am
doesnt work......its logical though
grudz
Forum Commoner
Posts: 68 Joined: Thu Dec 04, 2003 12:52 pm
Post
by grudz » Fri Dec 05, 2003 12:02 pm
anybody have any ideas...please....
Draco_03
Forum Regular
Posts: 577 Joined: Fri Aug 15, 2003 12:25 pm
Location: Montreal, Canada
Post
by Draco_03 » Fri Dec 05, 2003 12:05 pm
should work... giveus a bit more of your code and tell us what is the other colomn you want to show
ps : you can use
grudz
Forum Commoner
Posts: 68 Joined: Thu Dec 04, 2003 12:52 pm
Post
by grudz » Fri Dec 05, 2003 12:21 pm
Code: Select all
<?php
mysql_select_db($database_cnpa, $cnpa);
$query_forum = "SELECT DISTINCT question_title FROM forum ORDER BY `date` DESC";
$forum = mysql_query($query_forum, $cnpa) or die(mysql_error());
$row_forum = mysql_fetch_assoc($forum);
$totalRows_forum = mysql_num_rows($forum);
?>
my other columns that i need are : name, date, question, reply, reply_name, reply_date
if u want more code....ill give u everything....but i guess this part is the important one
grudz
Forum Commoner
Posts: 68 Joined: Thu Dec 04, 2003 12:52 pm
Post
by grudz » Fri Dec 05, 2003 12:27 pm
whats weird is that it does sort it by date (in descending order) so it sort of "rocognizes" the other columns...but when i echo it.....i dont see anything