|
|
|
สอบถาม PHP การดึงข้อมูลจาก EXCEL อัพเดตลง phpmyadmin |
|
|
|
|
|
|
|
ตอน run code มองเห็นข้อมูลที่ EXCEL นะครับ มีปัญหากับคำสั่ง SQL UPDATE
ช่วงตรงนี้อะครับ ทำยังไงจะให้มองเห็นตัวแปรนี้ครับ
Code (PHP)
'".$xlSheet1->Cells->Item($i,x)."' ";
$strSQL .="user_fb = '".$xlSheet1->Cells->Item($i,2)."' ";
$strSQL .=",e_mail = '".$xlSheet1->Cells->Item($i,3)."' ";
$strSQL .=",photo_customer = '".$xlSheet1->Cells->Item($i,4)."' ";
$strSQL .=",photo_customer2 = '".$xlSheet1->Cells->Item($i,5)."' ";
$strSQL .=",status2 = '".$xlSheet1->Cells->Item($i,6)."' ";
$strSQL .=",month_id = '".$xlSheet1->Cells->Item($i,7)."' ";
$strSQL .=",year_id = '".$xlSheet1->Cells->Item($i,8)."' ";
$strSQL .=",time2 = '".$xlSheet1->Cells->Item($i,9)."' ";
$strSQL .=",date = '".$xlSheet1->Cells->Item($i,10)."' ";
มันมองไม่เห็นตัวแปร
Code (PHP)
<?
//*** Get Document Path ***//
$strPath = realpath(basename(getenv($_SERVER["SCRIPT_NAME"]))); // C:/AppServ/www/myphp
$OpenFile = "data.xls";
//*** Create Exce.Application ***//
$xlApp = new COM("Excel.Application");
$xlBook = $xlApp->Workbooks->Open($strPath."/".$OpenFile);
//$xlBook = $xlApp->Workbooks->Open(realpath($OpenFile));
$xlSheet1 = $xlBook->Worksheets(1);
?>
<table width="420" border="1">
<?for($i=1;$i<=5;$i++){?>
<tr>
<td><?=$xlSheet1->Cells->Item($i,1);?></td>
<td><?=$xlSheet1->Cells->Item($i,2);?></td>
<td><?=$xlSheet1->Cells->Item($i,3);?></td>
<td><?=$xlSheet1->Cells->Item($i,4);?></td>
<td><?=$xlSheet1->Cells->Item($i,5);?></td>
<td><?=$xlSheet1->Cells->Item($i,6);?></td>
<td><?=$xlSheet1->Cells->Item($i,7);?></td>
<td><?=$xlSheet1->Cells->Item($i,8);?></td>
<td><?=$xlSheet1->Cells->Item($i,9);?></td>
<td><?=$xlSheet1->Cells->Item($i,10);?></td>
</tr>
<?}?>
</table>
<?
//*** Close & Quit ***//
//$xlApp->Application->Quit();
//$xlApp = null;
// $xlBook = null;
//$xlSheet1 = null;
$objConnect = mysql_connect("localhost","root","") or die("Error Connect to Database");
$objDB = mysql_select_db("touchamoment");
$strSQL = "UPDATE facebook SET ";
$strSQL .="user_fb = '".$xlSheet1->Cells->Item($i,2)."' ";
$strSQL .=",e_mail = '".$xlSheet1->Cells->Item($i,3)."' ";
$strSQL .=",photo_customer = '".$xlSheet1->Cells->Item($i,4)."' ";
$strSQL .=",photo_customer2 = '".$xlSheet1->Cells->Item($i,5)."' ";
$strSQL .=",status2 = '".$xlSheet1->Cells->Item($i,6)."' ";
$strSQL .=",month_id = '".$xlSheet1->Cells->Item($i,7)."' ";
$strSQL .=",year_id = '".$xlSheet1->Cells->Item($i,8)."' ";
$strSQL .=",time2 = '".$xlSheet1->Cells->Item($i,9)."' ";
$strSQL .=",date = '".$xlSheet1->Cells->Item($i,10)."' ";
$strSQL .="WHERE id = '6525' ";
$objQuery = mysql_query($strSQL);
?>
Tag : PHP, CakePHP
|
|
|
|
|
|
Date :
2011-07-25 13:30:57 |
By :
adisak00 |
View :
1814 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
คุณอ่านเป็น Loop แต่คุณเรียกตัวแปรนอก loop แล้วมันจะอ่านค่าได้เหรอครับ
|
|
|
|
|
Date :
2011-07-26 08:57:58 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|