Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,038

HOME > PHP > PHP Forum > ช่วยดู Code หน่อยครับว่าทำไมถึง บวกลบตัวแปรไม่ได้ ทังๆที่ echo ตัวแปรออกมาดูแต่ละตัวก็มีค่า


[PHP] ช่วยดู Code หน่อยครับว่าทำไมถึง บวกลบตัวแปรไม่ได้ ทังๆที่ echo ตัวแปรออกมาดูแต่ละตัวก็มีค่า

 
Topic : 077326



โพสกระทู้ ( 316 )
บทความ ( 0 )



สถานะออฟไลน์



ช่วยดู Code หน่อยครับว่าทำไมถึง บวกลบตัวแปรไม่ได้ ทั้งๆที่ตัวแปรแต่ละตัว ลอง echo ออกมา ก็มีค่า แต่พอเอาตัวแปรมาลบกัน ค่าที่ออกมามันไม่ได้

Code (PHP)
01.<?
02.            $_GET['SUMCREDIT'] = number_format($intTotal_Credit1,2);
03.            $numd1 = $_GET['SUMDABIT'];
04.            $numc1 = $_GET['SUMCREDIT'];
05.            $a = $numc1+$numd1;
06.             
07.            echo "$numd1<br />";
08.            echo "$numc1<br />";
09.            echo "$a";
10. 
11.?>


ค่าที่ได้

1,017,860.05
1,766,444.92
2
-----------------------------------------------------------------
Code php ทั้งหมดครับ

Code (PHP)
001.<?
002.if($_GET["dept"] != "")
003.    {
004. 
005.    $strSQL =
006.     
007.    "SELECT
008.    T2.AcctName,
009.    sum(case month(T0.RefDate) when 1 then (T1.Debit -T1.credit) else 0 end) as 'd01',
010.    sum(case month(T0.RefDate) when 2 then (T1.Debit -T1.credit) else 0 end) as 'd02',
011.    sum(case month(T0.RefDate) when 3 then (T1.Debit -T1.credit) else 0 end) as 'd03',
012.    sum(case month(T0.RefDate) when 4 then (T1.Debit -T1.credit) else 0 end) as 'd04',
013.    sum(case month(T0.RefDate) when 5 then (T1.Debit -T1.credit) else 0 end) as 'd05',
014.    sum(case month(T0.RefDate) when 6 then (T1.Debit -T1.credit) else 0 end) as 'd06',
015.    sum(case month(T0.RefDate) when 7 then (T1.Debit -T1.credit) else 0 end) as 'd07',
016.    sum(case month(T0.RefDate) when 8 then (T1.Debit -T1.credit) else 0 end) as 'd08',
017.    sum(case month(T0.RefDate) when 9 then (T1.Debit -T1.credit) else 0 end) as 'd09',
018.    sum(case month(T0.RefDate) when 10 then (T1.Debit -T1.credit) else 0 end) as 'd10',
019.    sum(case month(T0.RefDate) when 11 then (T1.Debit -T1.credit) else 0 end) as 'd11',
020.    sum(case month(T0.RefDate) when 12 then (T1.Debit -T1.credit) else 0 end) as 'd12'
021.    FROM
022.    OJDT T0 
023.    INNER JOIN JDT1 T1 ON T0.TransId = T1.TransId
024.    INNER JOIN OACT T2 ON T1.Account = T2.AcctCode
025.    WHERE
026.    (T2.segment_0 >= '510000000000' and T2.segment_0  <= '541048010000') and
027.    (T2.segment_1 LIKE '%".$_GET["dept"]."%') AND
028.    (year(T0.RefDate) LIKE '%".$_GET["year"]."%')
029.    GROUP BY 
030.    T2.AcctName
031.    ORDER BY T2.AcctName ASC";
032. 
033.     
034.     
035.    $objQuery = mssql_query($strSQL) or die ("Error Query [".$strSQL."]");
036. 
037.?>
038. 
039.    <table width="100%" border="1" align="center" cellspacing="0" bordercolor="#000000" bgcolor="#0033FF">
040.      <tr bgcolor="#FF00FF">
041.        <th width="18"><span class="style13">No.</span></th>
042.        <th width="80"><span class="style13">Description</span></th>
043.        <th width="60"><span class="style13">January</span></th>
044.        <th width="60"><span class="style13">February</span></th>
045.        <th width="60"><span class="style13">February</span></th>
046.        <th width="60"><span class="style13">April</span></th>
047.        <th width="60"><span class="style13">May</span></th>
048.        <th width="60"><span class="style13">June</span></th>
049.        <th width="60"><span class="style13">July</span></th>
050.        <th width="60"><span class="style13">August</span></th>
051.        <th width="60"><span class="style13">September</span></th>
052.        <th width="60"><span class="style13">October</span></th>
053.        <th width="60"><span class="style13">November</span></th>
054.        <th width="60"><span class="style13">December</span></th>
055.      </tr>
056.    <?
057.        $i=1;
058.        $j=1;
059.        $intTotal_Debit1 = 0;
060.        $intTotal_Credit1 = 0;
061.        $intTotal_Debit2 = 0;
062.        $intTotal_Credit2 = 0;
063.        $intTotal_Debit3 = 0;
064.        $intTotal_Credit3 = 0;
065.        $intTotal_Debit4 = 0;
066.        $intTotal_Credit4 = 0;
067.        $intTotal_Debit5 = 0;
068.        $intTotal_Credit5 = 0;
069.        $intTotal_Debit6 = 0;
070.        $intTotal_Credit6 = 0;
071.        $intTotal_Debit7 = 0;
072.        $intTotal_Credit7 = 0;
073.        $intTotal_Debit8 = 0;
074.        $intTotal_Credit8 = 0;
075.        $intTotal_Debit9 = 0;
076.        $intTotal_Credit9 = 0;
077.        $intTotal_Debit10 = 0;
078.        $intTotal_Credit10 = 0;
079.        $intTotal_Debit11 = 0;
080.        $intTotal_Credit11 = 0;
081.        $intTotal_Debit12 = 0;
082.        $intTotal_Credit12 = 0;
083.         
084.        while($objResult = mssql_fetch_array($objQuery))
085.        //while($objResult = mssql_fetch_array($objQuery) &&  $objResult2 = mssql_fetch_array($objQuery2))
086.        {
087.     
088.        $intTotal_Debit1 = $intTotal_Debit1 + $objResult["d01"];   
089.        $intTotal_Credit1 = $intTotal_Credit1 + $objResult["c01"];
090.        $intTotal_Debit2 = $intTotal_Debit2 + $objResult["d02"];
091.        $intTotal_Credit2 = $intTotal_Credit2 + $objResult["c02"];
092.        $intTotal_Debit3 = $intTotal_Debit3 + $objResult["d03"];
093.        $intTotal_Credit3 = $intTotal_Credit3 + $objResult["c03"];
094.        $intTotal_Debit4 = $intTotal_Debit4 + $objResult["d04"];
095.        $intTotal_Credit4 = $intTotal_Credit4 + $objResult["c04"];
096.        $intTotal_Debit5 = $intTotal_Debit5 + $objResult["d05"];
097.        $intTotal_Credit5 = $intTotal_Credit5 + $objResult["c05"];
098.        $intTotal_Debit6 = $intTotal_Debit6 + $objResult["d06"];
099.        $intTotal_Credit6 = $intTotal_Credit6 + $objResult["c06"];
100.        $intTotal_Debit7 = $intTotal_Debit7 + $objResult["d07"];
101.        $intTotal_Credit7 = $intTotal_Credit7 + $objResult["c07"];
102.        $intTotal_Debit8 = $intTotal_Debit8 + $objResult["d08"];
103.        $intTotal_Credit8 = $intTotal_Credit8 + $objResult["c08"];
104.        $intTotal_Debit9 = $intTotal_Debit9 + $objResult["d09"];
105.        $intTotal_Credit9 = $intTotal_Credit9 + $objResult["c09"];
106.        $intTotal_Debit10 = $intTotal_Debit10 + $objResult["d10"];
107.        $intTotal_Credit10 = $intTotal_Credit10 + $objResult["c10"];
108.        $intTotal_Debit11 = $intTotal_Debit11 + $objResult["d11"];
109.        $intTotal_Credit11 = $intTotal_Credit11 + $objResult["c11"];
110.        $intTotal_Debit12 = $intTotal_Debit12 + $objResult["d12"];
111.        $intTotal_Credit12 = $intTotal_Credit12 + $objResult["c12"];
112.        $j++;
113.        if($j%2==0)
114.        {
115.            $bg = "#99CCFF";
116.        }
117.        else
118.        {
119.            $bg = "#FFFFFF";
120.        }
121.    ?>
122.    
123.      <tr bgcolor="<?=$bg;?>">
124.        <td><div align="center" class="style8">
125.          <?=$i;?>
126.        </div></td>
127.        <!--<td><div align="left"><span class="style8"><?=$objResult["AcctCode"];?></span></div></td>-->
128.        <td><span class="style8">
129.          <?=$objResult["AcctName"];?>
130.        </span></td>
131.        <td><div align="right"><span class="style8"><?=number_format(substr($objResult["d01"],0,-4),2);?></span></div></td>
132.        <td><div align="right"><span class="style8">
133.          <?=number_format(substr($objResult["d02"],0,-4),2);?>
134.        </span></div></td>
135.        <td><div align="right"><span class="style8">
136.          <?=number_format(substr($objResult["d03"],0,-4),2);?>
137.        </span></div></td>
138.        <td><div align="right"><span class="style8">
139.          <?=number_format(substr($objResult["d04"],0,-4),2);?>
140.        </span></div></td>
141.        <td><div align="right"><span class="style8">
142.          <?=number_format(substr($objResult["d05"],0,-4),2);?>
143.        </span></div></td>
144.        <td><div align="right"><span class="style8">
145.          <?=number_format(substr($objResult["d06"],0,-4),2);?>
146.        </span></div></td>
147.        <td><div align="right"><span class="style8">
148.          <?=number_format(substr($objResult["d07"],0,-4),2);?>
149.        </span></div></td>
150.        <td><div align="right"><span class="style8">
151.          <?=number_format(substr($objResult["d08"],0,-4),2);?>
152.        </span></div></td>
153.        <td><div align="right"><span class="style8">
154.          <?=number_format(substr($objResult["d09"],0,-4),2);?>
155.        </span></div></td>
156.        <td><div align="right"><span class="style8">
157.          <?=number_format(substr($objResult["d10"],0,-4),2);?>
158.        </span></div></td>
159.        <td><div align="right"><span class="style8">
160.          <?=number_format(substr($objResult["d11"],0,-4),2);?>
161.        </span></div></td>
162.        <td><div align="right"><span class="style8">
163.          <?=number_format(substr($objResult["d12"],0,-4),2);?>
164.        </span></div></td>
165.      </tr>
166.       
167.       
168.       
169.    <?
170.        $i++;
171.    }
172.    ?>
173. 
174.       <tr bgcolor="#FFCC33">
175.         <td colspan="2" nowrap="nowrap"><div align="center">ToTal</div></td>
176.         <td nowrap="nowrap"><div align="right" class="style15">
177.           <?=number_format($intTotal_Debit1,2);?>
178.         </div></td>
179.         <td nowrap="nowrap"><div align="right" class="style15">
180.           <?=number_format($intTotal_Debit2,2);?>
181.         </div></td>
182.         <td nowrap="nowrap"><div align="right" class="style15">
183.           <?=number_format($intTotal_Debit3,2);?>
184.         </div></td>
185.         <td nowrap="nowrap"><div align="right" class="style15">
186.           <?=number_format($intTotal_Debit4,2);?>
187.         </div></td>
188.         <td nowrap="nowrap"><div align="right" class="style15">
189.           <?=number_format($intTotal_Debit5,2);?>
190.         </div></td>
191.         <td nowrap="nowrap"><div align="right" class="style15">
192.           <?=number_format($intTotal_Debit6,2);?>
193.         </div></td>
194.         <td nowrap="nowrap"><div align="right" class="style15">
195.           <?=number_format($intTotal_Debit7,2);?>
196.         </div></td>
197.         <td nowrap="nowrap"><div align="right" class="style15">
198.           <?=number_format($intTotal_Debit8,2);?>
199.         </div></td>
200.         <td nowrap="nowrap"><div align="right" class="style15">
201.           <?=number_format($intTotal_Debit9,2);?>
202.         </div></td>
203.         <td nowrap="nowrap"><div align="right" class="style15">
204.           <?=number_format($intTotal_Debit10,2);?>
205.         </div></td>
206.         <td nowrap="nowrap"><div align="right" class="style15">
207.           <?=number_format($intTotal_Debit11,2);?>
208.         </div></td>
209.         <td nowrap="nowrap"><div align="right" class="style15">
210.           <?=number_format($intTotal_Debit12,2);?>
211.</div></td>
212.       </tr>
213.</table>
214. 
215.    <? $_GET['SUMDABIT'] = number_format($intTotal_Debit1,2);?>
216. 
217.     
218.    <br>
219.    <?
220.    mssql_close($objConnect);
221.}
222.?>
223.    <?
224.if($_GET["dept"] != "")
225.    {
226. 
227.    $strSQL =
228.     
229.    "SELECT
230.    T2.AcctName,
231.    sum(case month(T0.RefDate) when 1 then (T1.Credit-T1.Debit) else 0 end) as 'c01',
232.    sum(case month(T0.RefDate) when 2 then (T1.Credit-T1.Debit) else 0 end) as 'c02',
233.    sum(case month(T0.RefDate) when 3 then (T1.Credit-T1.Debit) else 0 end) as 'c03',
234.    sum(case month(T0.RefDate) when 4 then (T1.Credit-T1.Debit) else 0 end) as 'c04',
235.    sum(case month(T0.RefDate) when 5 then (T1.Credit-T1.Debit) else 0 end) as 'c05',
236.    sum(case month(T0.RefDate) when 6 then (T1.Credit-T1.Debit) else 0 end) as 'c06',
237.    sum(case month(T0.RefDate) when 7 then (T1.Credit-T1.Debit) else 0 end) as 'c07',
238.    sum(case month(T0.RefDate) when 8 then (T1.Credit-T1.Debit) else 0 end) as 'c08',
239.    sum(case month(T0.RefDate) when 9 then (T1.Credit-T1.Debit) else 0 end) as 'c09',
240.    sum(case month(T0.RefDate) when 10 then (T1.Credit-T1.Debit) else 0 end) as 'c10',
241.    sum(case month(T0.RefDate) when 11 then (T1.Credit-T1.Debit) else 0 end) as 'c11',
242.    sum(case month(T0.RefDate) when 12 then (T1.Credit-T1.Debit) else 0 end) as 'c12'
243. 
244.    FROM
245.    OJDT T0 
246.    INNER JOIN JDT1 T1 ON T0.TransId = T1.TransId
247.    INNER JOIN OACT T2 ON T1.Account = T2.AcctCode
248.    WHERE
249.    (T2.segment_0 >= '410000000000' and T2.segment_0  <= '43100170000') and
250.    (T2.segment_1 LIKE '%".$_GET["dept"]."%') AND
251.    (year(T0.RefDate) LIKE '%".$_GET["year"]."%')
252.    GROUP BY 
253.    T2.AcctName
254.    ORDER BY T2.AcctName ASC";
255. 
256.     
257.     
258.    $objQuery = mssql_query($strSQL) or die ("Error Query [".$strSQL."]");
259. 
260.?>
261.<table width="100%" border="1" align="center" cellspacing="0" bordercolor="#000000" bgcolor="#0033FF">
262.      <tr bgcolor="#FF00FF">
263.        <th width="18"><span class="style13">No.</span></th>
264.        <th width="80"><span class="style13">Description</span></th>
265.        <th width="60"><span class="style13">January</span></th>
266.        <th width="60"><span class="style13">February</span></th>
267.        <th width="60"><span class="style13">March</span></th>
268.        <th width="60"><span class="style13">April</span></th>
269.        <th width="60"><span class="style13">May</span></th>
270.        <th width="60"><span class="style13">June</span></th>
271.        <th width="60"><span class="style13">July</span></th>
272.        <th width="60"><span class="style13">August</span></th>
273.        <th width="60"><span class="style13">September</span></th>
274.        <th width="60"><span class="style13">October</span></th>
275.        <th width="60"><span class="style13">November</span></th>
276.        <th width="60"><span class="style13">December</span></th>
277.      </tr>
278.      <?
279.        $i=1;
280.        $j=1;
281.        $intTotal_Debit1 = 0;
282.        $intTotal_Credit1 = 0;
283.        $intTotal_Debit2 = 0;
284.        $intTotal_Credit2 = 0;
285.        $intTotal_Debit3 = 0;
286.        $intTotal_Credit3 = 0;
287.        $intTotal_Debit4 = 0;
288.        $intTotal_Credit4 = 0;
289.        $intTotal_Debit5 = 0;
290.        $intTotal_Credit5 = 0;
291.        $intTotal_Debit6 = 0;
292.        $intTotal_Credit6 = 0;
293.        $intTotal_Debit7 = 0;
294.        $intTotal_Credit7 = 0;
295.        $intTotal_Debit8 = 0;
296.        $intTotal_Credit8 = 0;
297.        $intTotal_Debit9 = 0;
298.        $intTotal_Credit9 = 0;
299.        $intTotal_Debit10 = 0;
300.        $intTotal_Credit10 = 0;
301.        $intTotal_Debit11 = 0;
302.        $intTotal_Credit11 = 0;
303.        $intTotal_Debit12 = 0;
304.        $intTotal_Credit12 = 0;
305.         
306.        while($objResult = mssql_fetch_array($objQuery))
307.        //while($objResult = mssql_fetch_array($objQuery) &&  $objResult2 = mssql_fetch_array($objQuery2))
308.        {
309.     
310.        $intTotal_Debit1 = $intTotal_Debit1 + $objResult["d01"];   
311.        $intTotal_Credit1 = $intTotal_Credit1 + $objResult["c01"];
312.        $intTotal_Debit2 = $intTotal_Debit2 + $objResult["d02"];
313.        $intTotal_Credit2 = $intTotal_Credit2 + $objResult["c02"];
314.        $intTotal_Debit3 = $intTotal_Debit3 + $objResult["d03"];
315.        $intTotal_Credit3 = $intTotal_Credit3 + $objResult["c03"];
316.        $intTotal_Debit4 = $intTotal_Debit4 + $objResult["d04"];
317.        $intTotal_Credit4 = $intTotal_Credit4 + $objResult["c04"];
318.        $intTotal_Debit5 = $intTotal_Debit5 + $objResult["d05"];
319.        $intTotal_Credit5 = $intTotal_Credit5 + $objResult["c05"];
320.        $intTotal_Debit6 = $intTotal_Debit6 + $objResult["d06"];
321.        $intTotal_Credit6 = $intTotal_Credit6 + $objResult["c06"];
322.        $intTotal_Debit7 = $intTotal_Debit7 + $objResult["d07"];
323.        $intTotal_Credit7 = $intTotal_Credit7 + $objResult["c07"];
324.        $intTotal_Debit8 = $intTotal_Debit8 + $objResult["d08"];
325.        $intTotal_Credit8 = $intTotal_Credit8 + $objResult["c08"];
326.        $intTotal_Debit9 = $intTotal_Debit9 + $objResult["d09"];
327.        $intTotal_Credit9 = $intTotal_Credit9 + $objResult["c09"];
328.        $intTotal_Debit10 = $intTotal_Debit10 + $objResult["d10"];
329.        $intTotal_Credit10 = $intTotal_Credit10 + $objResult["c10"];
330.        $intTotal_Debit11 = $intTotal_Debit11 + $objResult["d11"];
331.        $intTotal_Credit11 = $intTotal_Credit11 + $objResult["c11"];
332.        $intTotal_Debit12 = $intTotal_Debit12 + $objResult["d12"];
333.        $intTotal_Credit12 = $intTotal_Credit12 + $objResult["c12"];
334.        $j++;
335.        if($j%2==0)
336.        {
337.            $bg = "#99CCFF";
338.        }
339.        else
340.        {
341.            $bg = "#FFFFFF";
342.        }
343.    ?>
344.      <tr bgcolor="<?=$bg;?>">
345.        <td><div align="center" class="style8">
346.            <?=$i;?>
347.        </div></td>
348.        <!--<td><div align="left"><span class="style8"><?=$objResult["AcctCode"];?></span></div></td>-->
349.        <td><span class="style8">
350.          <?=$objResult["AcctName"];?>
351.        </span></td>
352.        <td><div align="right"><span class="style8">
353.            <?=number_format(substr($objResult["c01"],0,-4),2);?>
354.        </span></div></td>
355.        <td><div align="right"><span class="style8">
356.            <?=number_format(substr($objResult["c02"],0,-4),2);?>
357.        </span></div></td>
358.        <td><div align="right"><span class="style8">
359.            <?=number_format(substr($objResult["c03"],0,-4),2);?>
360.        </span></div></td>
361.        <td><div align="right"><span class="style8">
362.            <?=number_format(substr($objResult["c04"],0,-4),2);?>
363.        </span></div></td>
364.        <td><div align="right"><span class="style8">
365.            <?=number_format(substr($objResult["c05"],0,-4),2);?>
366.        </span></div></td>
367.        <td><div align="right"><span class="style8">
368.            <?=number_format(substr($objResult["c06"],0,-4),2);?>
369.        </span></div></td>
370.        <td><div align="right"><span class="style8">
371.            <?=number_format(substr($objResult["c07"],0,-4),2);?>
372.        </span></div></td>
373.        <td><div align="right"><span class="style8">
374.            <?=number_format(substr($objResult["c08"],0,-4),2);?>
375.        </span></div></td>
376.        <td><div align="right"><span class="style8">
377.            <?=number_format(substr($objResult["c09"],0,-4),2);?>
378.        </span></div></td>
379.        <td><div align="right"><span class="style8">
380.            <?=number_format(substr($objResult["c10"],0,-4),2);?>
381.        </span></div></td>
382.        <td><div align="right"><span class="style8">
383.            <?=number_format(substr($objResult["c11"],0,-4),2);?>
384.        </span></div></td>
385.        <td><div align="right"><span class="style8">
386.            <?=number_format(substr($objResult["c12"],0,-4),2);?>
387.        </span></div></td>
388.      </tr>
389.      <?
390.        $i++;
391.    }
392.    ?>
393.      <tr bgcolor="#FFCC33">
394.        <td colspan="2" nowrap="nowrap"><div align="center">ToTal</div></td>
395.        <td nowrap="nowrap"><div align="right" class="style15">
396.            <?=number_format($intTotal_Credit1,2);?>
397.        </div></td>
398.        <td nowrap="nowrap"><div align="right" class="style15">
399.            <?=number_format($intTotal_Credit2,2);?>
400.        </div></td>
401.        <td nowrap="nowrap"><div align="right" class="style15">
402.            <?=number_format($intTotal_Credit3,2);?>
403.        </div></td>
404.        <td nowrap="nowrap"><div align="right" class="style15">
405.            <?=number_format($intTotal_Credit4,2);?>
406.        </div></td>
407.        <td nowrap="nowrap"><div align="right" class="style15">
408.            <?=number_format($intTotal_Credit5,2);?>
409.        </div></td>
410.        <td nowrap="nowrap"><div align="right" class="style15">
411.            <?=number_format($intTotal_Credit6,2);?>
412.        </div></td>
413.        <td nowrap="nowrap"><div align="right" class="style15">
414.            <?=number_format($intTotal_Credit7,2);?>
415.        </div></td>
416.        <td nowrap="nowrap"><div align="right" class="style15">
417.            <?=number_format($intTotal_Credit8,2);?>
418.        </div></td>
419.        <td nowrap="nowrap"><div align="right" class="style15">
420.            <?=number_format($intTotal_Credit9,2);?>
421.        </div></td>
422.        <td nowrap="nowrap"><div align="right" class="style15">
423.            <?=number_format($intTotal_Credit10,2);?>
424.        </div></td>
425.        <td nowrap="nowrap"><div align="right" class="style15">
426.            <?=number_format($intTotal_Credit11,2);?>
427.        </div></td>
428.        <td nowrap="nowrap"><div align="right" class="style15">
429.            <?=number_format($intTotal_Credit12,2);?>
430.        </div></td>
431.      </tr>
432.        <?
433.            $_GET['SUMCREDIT'] = number_format($intTotal_Credit1,2);
434.            $numd1 = $_GET['SUMDABIT'];
435.            $numc1 = $_GET['SUMCREDIT'];
436.            $a = $numc1+$numd1;
437.             
438.            echo "$numd1<br />";
439.            echo "$numc1<br />";
440.            echo "$a";
441. 
442.        ?>
443.      <tr bgcolor="#FFCC33">
444.        <td colspan="2" nowrap="nowrap"><div align="center">ToTal</div></td>
445.        <td nowrap="nowrap"><div align="right" class="style15">
446.            <? echo $numd1;?>
447.        </div></td>
448.        <td nowrap="nowrap"><div align="right" class="style15">
449.            <?=number_format($intTotal_Credit2,2) - number_format($numd1,2);?>
450.        </div></td>
451.        <td nowrap="nowrap"><div align="right" class="style15">
452.            <?=number_format($intTotal_Credit3,2);?>
453.        </div></td>
454.        <td nowrap="nowrap"><div align="right" class="style15">
455.            <?=number_format($intTotal_Credit4,2);?>
456.        </div></td>
457.        <td nowrap="nowrap"><div align="right" class="style15">
458.            <?=number_format($intTotal_Credit5,2);?>
459.        </div></td>
460.        <td nowrap="nowrap"><div align="right" class="style15">
461.            <?=number_format($intTotal_Credit6,2);?>
462.        </div></td>
463.        <td nowrap="nowrap"><div align="right" class="style15">
464.            <?=number_format($intTotal_Credit7,2);?>
465.        </div></td>
466.        <td nowrap="nowrap"><div align="right" class="style15">
467.            <?=number_format($intTotal_Credit8,2);?>
468.        </div></td>
469.        <td nowrap="nowrap"><div align="right" class="style15">
470.            <?=number_format($intTotal_Credit9,2);?>
471.        </div></td>
472.        <td nowrap="nowrap"><div align="right" class="style15">
473.            <?=number_format($intTotal_Credit10,2);?>
474.        </div></td>
475.        <td nowrap="nowrap"><div align="right" class="style15">
476.            <?=number_format($intTotal_Credit11,2);?>
477.        </div></td>
478.        <td nowrap="nowrap"><div align="right" class="style15">
479.            <?=number_format($intTotal_Credit12,2);?>
480.        </div></td>
481.      </tr>
482.    </table>
483.     
484.     
485.     
486.    <br>
487.    <p><?
488.    mssql_close($objConnect);
489.}
490.?>




Tag : PHP, Ms SQL Server 2005

Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-04-21 01:02:12 By : karurub View : 1149 Reply : 2
 

 

No. 1



โพสกระทู้ ( 22 )
บทความ ( 0 )



สถานะออฟไลน์


number_format เป็น Sting ฟังชั่นครับไม่สามารถคำนวนได้ต้องคำนวนเสร็จแล้วค่อย number_format ลองตัวอย่างครับ

Code (PHP)
1.<?php
2.$number_1 = 1000.20;
3.$number_2 = 1000.20;
4.$total    = $number_1 + $number_2;
5.echo $total."<br>";
6.echo number_format($total,2);
7.?>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-04-21 01:26:34 By : golfer4425
 

 

No. 2



โพสกระทู้ ( 316 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 1 เขียนโดย : golfer4425 เมื่อวันที่ 2012-04-21 01:26:34
รายละเอียดของการตอบ ::
ขอบคุณมากครับ สามารถทำได้แล้วครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-04-21 02:58:09 By : karurub
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ช่วยดู Code หน่อยครับว่าทำไมถึง บวกลบตัวแปรไม่ได้ ทังๆที่ echo ตัวแปรออกมาดูแต่ละตัวก็มีค่า
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)





ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2025 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่