Go Back   Webmaster Malaysia Forum » Website Design & Development » Website Programming

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 25-10-2004, 12:27 AM
Novice Webmaster
 
Join Date: Sep 2004
Location: Shah Alam
Posts: 68
Rep Power: 50
infeeneetee is on a distinguished road
mysql: taknak kluar byk2 camana?

hehe.. maaf le subject aku tue tak brapa jelas ...

gini..

contohnya aku ada 3 Fields dalam 1 table...
contohnya:

Nama table 'ilmu'

1. bab
2. tajuk
3. content

masalahnya bila aku tak pandai nak querykan utk display semua tajuk dan nak hanya 1 bab je..

contohnya:-

Bab: Solat
-------------------------
Tajuk: 1) Rukun Solat
Tajuk: 2) Adab Solat
Tajuk: 3) Syarat Sah Solat

yang aku buat keluar cam nie:-

Bab: Solat Solat Solat
---------------------------
Tajuk: 1) Rukun Solat
Tajuk: 2) Adab Solat
Tajuk: 3) Syarat Sah Solat


jadi.....
aku taknak "Solat Solat Solat"
yang aku nak "Solat"
dia keluar satu je..

camana yek?..
maaf le kalau tak jelas.. saya pun baru belajo... tak reti sgt & nak minta tolong korang ajarkn...

terima kasih saya dahulukan...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 25-10-2004, 02:51 AM
lcf's Avatar
lcf lcf is offline
Pro-Blogger
 
Join Date: Feb 2003
Location: Kluang, Johor
Posts: 2,376
Rep Power: 115
lcf will become famous soon enough
Send a message via ICQ to lcf Send a message via MSN to lcf Send a message via Yahoo to lcf
dont quite understand. show us your query string?
__________________
LiewCF | Malaysia Bloggers Forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 25-10-2004, 05:21 AM
MHR's Avatar
MHR MHR is offline
Senior Webmaster
 
Join Date: Sep 2001
Location: epox
Posts: 435
Rep Power: 93
MHR is on a distinguished road
Send a message via ICQ to MHR Send a message via Yahoo to MHR
WHERE bab=solat or LIMIT 1?
__________________
Munzir + "/^[Hh](a)(z)\1\2[iI]$/"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 25-10-2004, 05:33 AM
Novice Webmaster
 
Join Date: Sep 2004
Location: Shah Alam
Posts: 68
Rep Power: 50
infeeneetee is on a distinguished road
that was just a simple example..

my real query something like this....


PHP Code:
    <?
    
if (isset($_GET['do']))
    {
    echo 
'<table width= "300" align="left"><tr><td align="left"><b>Pilih bab di bawah:</b><br><br></td>';
        
db_connect('databasename''username');
        
$query "SELECT ct_id, ct_topic, ct_sub_topic, ct_page FROM surau_content LEFT JOIN surau_category ON 
              surau_content.ct_cat = surau_category.cat_id WHERE surau_category.cat_name = '$do' ORDER BY ct_id;"
;
        
$result = @mysql_query($query);

            while (
$row mysql_fetch_array($result,MYSQL_ASSOC))
            {
                echo 
"<tr><td align=\"left\">{$row['ct_topic']}:-";
                echo 
"<tr><td align=\"left\">{$row['ct_sub_topic']}";
                echo 
"</td></tr>";
            }
            echo 
'</table>';
                
        
mysql_close();
    } 
    
?>

Last edited by infeeneetee; 25-10-2004 at 06:20 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 25-10-2004, 05:43 AM
Novice Webmaster
 
Join Date: Sep 2004
Location: Shah Alam
Posts: 68
Rep Power: 50
infeeneetee is on a distinguished road
The output:-



Pilih bab di bawah:

Thaharah:-
Bersuci
Thaharah:-
Najis Dan Penyucian
Thaharah:-
Istinja'
Thaharah:-
Mandi Wajib
Thaharah:-
Wuduk
Thaharah:-
Tayammum
Solat:-
Perkara Asas Bagi Solat
Solat:-
Sunat Dan Makruh Dalam Solat
Solat:-
Adab Dan Waktu Dilarang Solat
Solat:-
Sujud
Solat:-
Solat Jemaah
Solat:-
Solat Jumaat
Puasa:-
Ibadat Puasa
Puasa:-
Rukun Dan Syarat Puasa
Puasa:-
Hukum-Hukum
Puasa:-
Hikmah Puasa
Zakat:-
Ibadah Zakat
Zakat:-
Perihal Zakat
Haji Dan Umrah:-
Ibadah Haji
Haji Dan Umrah:-
Perihal Haji
Haji Dan Umrah:-
Perihal Umrah



What i want is something like this:-



Pilih bab di bawah:

Thaharah:-
Bersuci
Najis Dan Penyucian
Istinja'
Mandi Wajib
Wuduk
Tayammum

Solat:-
Perkara Asas Bagi Solat
Sunat Dan Makruh Dalam Solat
Adab Dan Waktu Dilarang Solat
Sujud
Solat Jemaah
Solat Jumaat

Puasa:-
Ibadat Puasa
Rukun Dan Syarat Puasa
Hukum-Hukum
Hikmah Puasa

Zakat:-
Ibadah Zakat
Perihal Zakat

Haji Dan Umrah:-
Ibadah Haji
Perihal Haji
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 25-10-2004, 05:51 AM
Novice Webmaster
 
Join Date: Sep 2004
Location: Shah Alam
Posts: 68
Rep Power: 50
infeeneetee is on a distinguished road
should i just seperate become two queries or any other ideas??
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 25-10-2004, 05:56 AM
Novice Webmaster
 
Join Date: Sep 2004
Location: Shah Alam
Posts: 68
Rep Power: 50
infeeneetee is on a distinguished road
Quote:
Originally posted by MHR
WHERE bab=solat or LIMIT 1?

e eh?... bile mase lak MHR posting??...
alamak.. soalan ke tue??
kalau soalan boleh ulang semua tak.. tak faham le...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 25-10-2004, 09:48 PM
YajivMalhotra's Avatar
Novice Webmaster
 
Join Date: Oct 2004
Location: Johor Bahru, Malaysia
Posts: 41
Rep Power: 0
YajivMalhotra is on a distinguished road
Send a message via Yahoo to YajivMalhotra
memang susah nak bagi jawapan untuk soalan.. ni.. 30 minit aku duk depan pc... tengok screen.. pikir cam ner nak solve prob...

apa yang aku dapat fikir... untuk menyenangkan... buat table berlainan untuk topic topic berlainan...

cam Solat 1 table... Puasa 1 table... mungkin ni cara aku la... org lain ader cara diorang sendiri.... so baik tnggu diorang skali..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 25-10-2004, 10:24 PM
Novice Webmaster
 
Join Date: Sep 2004
Location: Shah Alam
Posts: 68
Rep Power: 50
infeeneetee is on a distinguished road
sebab dia kuar dalam bentuk array... kalau aku buat satu2 camano lak tue...

apa2pun aku berterima kasih pada YajivMalhotra 30 jam dok pikiaq...

takpe kita tgk dulu yg lain.. kalau takde aku kena tuka jadi bab satu page tajuk satu page.. tapi kalau boleh aku nak lari dari syle camnie sebab menyusahkan users nak surf..

Last edited by infeeneetee; 25-10-2004 at 10:29 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 25-10-2004, 10:38 PM
mysticmind's Avatar
Super Moderator
 
Join Date: Jun 2001
Location: Mystic Kingdoms
Posts: 2,619
Rep Power: 141
mysticmind will become famous soon enough mysticmind will become famous soon enough
Send a message via Yahoo to mysticmind
satu page pun takper...
alternative ko bleh seperate each buat function suku2 kan.
function solat, function puasa .. define la semula.
__________________
Personal's Blog! - Malaysian Artist!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #11 (permalink)  
Old 25-10-2004, 10:51 PM
Novice Webmaster
 
Join Date: Sep 2004
Location: Shah Alam
Posts: 68
Rep Power: 50
infeeneetee is on a distinguished road
$row['ct_topic'] akan keluar :-
-solat
-thaharah
-puasa
...

$row['ct_sub_topic'] akan keluar:-
-Perkara Asas Bagi Solat
-Sunat Dan Makruh Dalam Solat
-Ibadah Zakat
-Perihal Zakat

camanolak aku nak functionkan solat satu, thaharah satu bla bla,,,,
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 26-10-2004, 01:23 AM
Novice Webmaster
 
Join Date: Sep 2004
Location: Shah Alam
Posts: 68
Rep Power: 50
infeeneetee is on a distinguished road
hah... jadi dah... !!

betul la kena guna function, then dalam function kena guna while dalam while...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 26-10-2004, 11:51 AM
mysticmind's Avatar
Super Moderator
 
Join Date: Jun 2001
Location: Mystic Kingdoms
Posts: 2,619
Rep Power: 141
mysticmind will become famous soon enough mysticmind will become famous soon enough
Send a message via Yahoo to mysticmind
tumpang bangge nih,...
__________________
Personal's Blog! - Malaysian Artist!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 26-10-2004, 03:08 PM
YajivMalhotra's Avatar
Novice Webmaster
 
Join Date: Oct 2004
Location: Johor Bahru, Malaysia
Posts: 41
Rep Power: 0
YajivMalhotra is on a distinguished road
Send a message via Yahoo to YajivMalhotra
ah ah.. tak fikir pasal function plak.. aku.. hehe.. class pun boleh pakai gak..:P
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 26-10-2004, 03:24 PM
Novice Webmaster
 
Join Date: Sep 2004
Location: Shah Alam
Posts: 68
Rep Power: 50
infeeneetee is on a distinguished road
hehe.. aku masih tak pandai pakai class... ada website baguih dak utk tutorial class... .
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Camana nak buat login miss_tlot Website Programming 4 11-08-2003 12:16 PM
tolong ajar camana nak guna frontpage nak buat web? superrahim Webmaster Tools 0 24-05-2003 11:45 PM



All times are GMT +8. The time now is 01:31 AM. Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.


WebmasterMalaysia.com is Proudly Hosted by Exabytes Semi Dedicated Server.