|
|||
|
|||
Ic,
for this example we will have 2 fields: Name (abu, ali, etc.) and Number (5,9, etc.) The easiest way is to do something like the following: PHP Code:
|
|
|||
Use this SQL
Code:
$sql = "select sum(vol) where user like 'abu'";
__________________
-------------------------------------------- Khairil Iszuddin Ismail Last edited by kidino; 20-01-2004 at 10:39 AM. |
|
||||
ini pandangan aku ler... <== korang boleh celah kalau aku silap
result memang sama, tp lebih ekfisien (btul ke eja ni ) kalau guna terus kat query. sbb nak elak looping while tuh... so aku rasa lg cepat guna query tuh... cepat skit ler.. bukan byk pun.. hihihikbtul tak? ker salah? ![]()
__________________
^_^ <== stay happy |
|
|||
That is correct. Using the direct query method does eliminate a process and does improve efficiency. However, the improvement in performance between the two methods are negligible for a small database.
The example given in this topic is very basic. If you needed a more complex function, the second method would be of more use as you could intergrate the power of PHP to manipulate your data. As for 'LIKE' rather than "=", I disagree with that statement as the equal sign (=) is the equivalent of IN in SQL, which returns exact matches. LIKE is better used for a pattern with wildcards (%). Anyhow, both methods will work ('IN' - = or 'LIKE' - without wildcards %), and there are no performance differences between the two. |
![]() |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Visitor's Count | patcjh | Website Programming | 12 | 24-01-2007 05:22 AM |
| Total newbie here >_< | Pip_X | Website Programming | 2 | 12-04-2006 01:12 PM |
| Total form looping textfield | koisempoi | Website Design | 2 | 09-05-2005 12:35 PM |
| Whois: total domain hosted | Filuren | Paid Hosting Discussion Forum | 12 | 08-10-2004 01:54 AM |
| PHP FrameWork For TOTAL NEWBIE | bazet | Website Programming | 13 | 02-12-2002 04:19 PM |
All times are GMT +8. The time now is 03:15 PM.
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.
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.












Linear Mode

