ผมทำอะไรผิด งงไปหมดแล้ว [PHP]

เริ่มโดย เทมาเส็ก, 22 มีนาคม 2011, 20:00:43

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

เทมาเส็ก

สรุปรวมเลยนะครับ
ไฟล์ class-database.php ถ้าไม่คอมเม้นบรรทัดนี้ //require_once 'class-tool.php'; ไว้จะขึ้นแบบนี้ครับ
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/com12317/public_html/nongfang/class-database.php on line 1

<?php

//require_once 'class-tool.php';

class database_app {    

    private 
$tool;

    private 
$config;

    private 
$link;



    public function 
__construct(){

        
$this->tool = new tool_app();

        
$this->config $this->tool->request_config();

        
$this->connect_database();

    }



    public function 
connect_database(){

        
$this->link mysql_connect($this->config['db']['host'], $this->config['db']['user'], $this->config['db']['pass']);

        
mysql_query("USE {$this->config['db']['name']}"$this->link);

        
mysql_query("SET NAMES utf8"$this->link);

    }

}
?>



ไฟล์ auto-config.php จะขึ้น error แบบนี้ครับ
Fatal error: Class 'database_app' not found in /home/com12317/public_html/nongfang/auto-config.php on line 8

<?php
set_time_limit
(0);

require_once 
'class-tool.php';
$tool = new tool_app();

require_once 
'class-database.php';
$database = new database_app();

$wp $database->wordpress_config();
$tool->display_array($wp);

if(
$wp != false){
    require_once 
'class-wordpress.php';
    
$wordpress = new wordpress_app("http://www.{$wp['w_url']}/");

    
$writing $wordpress->writing_setting();
    
$return_data[] = $writing;

    
$delete_post $wordpress->delete_post();
    
$return_data[] = $delete_post;

    
$delete_page $wordpress->delete_page();
    
$return_data[] = $delete_page;

    
$add_category $wordpress->create_category();
    
$category_count = (int)count($add_category);
    for(
$c 0$c $category_count$c++){
        
$return_data[] = $add_category[$c];
    }

    
$delete_link $wordpress->delete_link();
    
$link_count = (int)count($delete_link);
    for(
$a 0$a $link_count$a++){
        
$return_data[] = $delete_link[$a];
    }

    
$general $wordpress->general_setting($wp['w_url'], 'Dofollow Social Bookmarking Sites. Get One Way Backlinks.');
    
$return_data[] = $general;

    
$discussion $wordpress->discussion_setting();
    
$return_data[] = $discussion;

    
$permalink $wordpress->permalink_setting();
    
$return_data[] = $permalink;

    
$plugin $wordpress->activate_plugin();
    
$plugin_count = (int)count($plugin);
    for(
$b 0$b $plugin_count$b++){
        
$return_data[] = $plugin[$b];
    }

    
$seo $wordpress->seo_setting($wp['w_url'], 'Dofollow Social Bookmarking Sites. Get One Way Backlinks.''dofollow, social, bookmarking, sites, get, one, way, backlinks');
    
$return_data[] = $seo;

    
$sitemap $wordpress->sitemap_setting();
    
$return_data[] = $sitemap;
}

?>


BeerSkz


หนุกหนาน

ทำไมมันไม่มีวงเล็บล่ะครับ

เทมาเส็ก

ปกติใช้แบบไม่มีวงเล็บก็ไม่มีปัญหาครับ

ผมแก้ตามท่าน BeerSkz แล้วก็ยังขึ้นเหมือนเดิมครับ :wanwan031:

เทมาเส็ก

โค้ทเต็มๆเป็นแบบนี้ครับ

require_once('class-database.php');
$db = new database_app();

$wp = $db->wordpress_config();
$tool->display_array($wp);


แต่มันฟ้องว่า
Fatal error: Class 'database_app' not found in /home/com12317/public_html/nongfang/auto-config.php on line 8

Synchronize

ผมก็กำลังจะโพส ว่า จริงๆ พวก  include , require มันมี หรือไม่มีวงเล็บก็ได้นะครับ

ลองเอาไฟล์เต็มๆ มาให้ดูหน่อยสิครับ ผมแปลใจตรง มันแจ้ง บรรทัดที่ 1 นี่ล่ะ

ปกติบรรทัดที่ 1 มันน่าจะเป็น

<?php

ไม่ใช่เหรอครับ

 :wanwan017:
เนื้อหาความรู้น่าสนใจ ใหม่ๆ
[direct=https://develop.un-no.com/w3/docs/clear-float-in-div]เทคนิคการแก้ไขปัญหาจากการ float ซ้อน float แล้ว clear[/direct]

[direct=https://service.un-no.com/unbbz]ทำเว็บได้ด้วยตัวเองฟรี ด้วยระบบเว็บสำเร็จรูป unbbz , เว็บธรรมดา , เว็บบอร์ด , เว็บขายของ ทำได้หมดเลย[/direct]

เทมาเส็ก

auto-config.php ครับ

<?php
set_time_limit
(0);

require_once 
'class-tool.php';
$tool = new tool_app();

require_once(
'class-database.php');
$db = new database_app();

$wp $database->wordpress_config();
$tool->display_array($wp);

if(
$wp != false){
    require_once 
'class-wordpress.php';
    
$wordpress = new wordpress_app("http://www.{$wp['w_url']}/");

    
$writing $wordpress->writing_setting();
    
$return_data[] = $writing;

    
$delete_post $wordpress->delete_post();
    
$return_data[] = $delete_post;

    
$delete_page $wordpress->delete_page();
    
$return_data[] = $delete_page;

    
$add_category $wordpress->create_category();
    
$category_count = (int)count($add_category);
    for(
$c 0$c $category_count$c++){
        
$return_data[] = $add_category[$c];
    }

    
$delete_link $wordpress->delete_link();
    
$link_count = (int)count($delete_link);
    for(
$a 0$a $link_count$a++){
        
$return_data[] = $delete_link[$a];
    }

    
$general $wordpress->general_setting($wp['w_url'], 'Dofollow Social Bookmarking Sites. Get One Way Backlinks.');
    
$return_data[] = $general;

    
$discussion $wordpress->discussion_setting();
    
$return_data[] = $discussion;

    
$permalink $wordpress->permalink_setting();
    
$return_data[] = $permalink;

    
$plugin $wordpress->activate_plugin();
    
$plugin_count = (int)count($plugin);
    for(
$b 0$b $plugin_count$b++){
        
$return_data[] = $plugin[$b];
    }

    
$seo $wordpress->seo_setting($wp['w_url'], 'Dofollow Social Bookmarking Sites. Get One Way Backlinks.''dofollow, social, bookmarking, sites, get, one, way, backlinks');
    
$return_data[] = $seo;

    
$sitemap $wordpress->sitemap_setting();
    
$return_data[] = $sitemap;
}

?>


Synchronize

แล้ว ตอนนี้ error เป็นแบบไหนเหรอครับ

  :wanwan017:
เนื้อหาความรู้น่าสนใจ ใหม่ๆ
[direct=https://develop.un-no.com/w3/docs/clear-float-in-div]เทคนิคการแก้ไขปัญหาจากการ float ซ้อน float แล้ว clear[/direct]

[direct=https://service.un-no.com/unbbz]ทำเว็บได้ด้วยตัวเองฟรี ด้วยระบบเว็บสำเร็จรูป unbbz , เว็บธรรมดา , เว็บบอร์ด , เว็บขายของ ทำได้หมดเลย[/direct]

เทมาเส็ก


Fatal error: Class 'database_app' not found in /home/com12317/public_html/nongfang/auto-config.php on line 8

ครับ
ทั้งๆที่มี Class 'database_app' อยู่จริงๆ :wanwan035:

lucationjj

ดูที่ database ยัง

ใช่ปะ ผมมั่วนะ :-[ :-[
[direct=][/direct]
วันนี้มี ไม่มีบล็อก index แล้ว

pollok

อ้างถึงจาก: เทมาเส็ก ใน 22 มีนาคม 2011, 20:20:17

Fatal error: Class 'database_app' not found in /home/com12317/public_html/nongfang/auto-config.php on line 8

ครับ
ทั้งๆที่มี Class 'database_app' อยู่จริงๆ :wanwan035:

โปรแกรมก็บอกอยู่ว่าไม่พบ ลองไล่ดูดีๆครับ
รับทำเว็บไซต์ด้วย PHP HTML CSS JQUERY (ด้วยมืออาชีพ)
รับออกแบบเว็บไซต์ ด้วยทีมงานมืออาชีพ (PM ขอชมผลงาน)
ตัดแบบจาก PSD ด้วย Html + Css + Table Less และสามารถทำให้แสดงผลแบบ Cross Browser
- Bootstrap
- OpenCart
- และอื่นๆ

Synchronize

อ้างถึงจาก: เทมาเส็ก ใน 22 มีนาคม 2011, 20:20:17

Fatal error: Class 'database_app' not found in /home/com12317/public_html/nongfang/auto-config.php on line 8

ครับ
ทั้งๆที่มี Class 'database_app' อยู่จริงๆ :wanwan035:

มี class database_app อยู่ในไฟล์  class-database.php  อยู่แล้วเหรอครับ

ลองเอาไฟล์มาดูหน่อยสิครับ

 :wanwan017:
เนื้อหาความรู้น่าสนใจ ใหม่ๆ
[direct=https://develop.un-no.com/w3/docs/clear-float-in-div]เทคนิคการแก้ไขปัญหาจากการ float ซ้อน float แล้ว clear[/direct]

[direct=https://service.un-no.com/unbbz]ทำเว็บได้ด้วยตัวเองฟรี ด้วยระบบเว็บสำเร็จรูป unbbz , เว็บธรรมดา , เว็บบอร์ด , เว็บขายของ ทำได้หมดเลย[/direct]

เทมาเส็ก

#12
class-database.php

<?php

require_once 'class-tool.php';

class 
database_app {    

    private 
$tool;

    private 
$config;

    private 
$link;



    public function 
__construct(){

        
$this->tool = new tool_app();

        
$this->config $this->tool->request_config();

        
$this->connect_database();

    }



    public function 
connect_database(){

        
$this->link mysql_connect($this->config['db']['host'], $this->config['db']['user'], $this->config['db']['pass']);

        
mysql_query("USE {$this->config['db']['name']}"$this->link);

        
mysql_query("SET NAMES utf8"$this->link);

    }

}
?>


aum_mix

ขายที่ดิน 31 ไร่ อยู่ [direct=http://www.thailandpremiumproperty.com]ที่ดินสวย[/direct] ทำเลดีติดถนน เหมาะแก่การลงทุนเป็นอย่างยิ่ง [direct=http://www.thailandpremiumproperty.com]ที่ดินทำเลดี[/direct] และที่ดิน 2,000 ไร่ จังหวัดกาญจนบุรี [direct=http://www.thailandpremiumproperty.com]ที่ดินราคาดี[/direct]

execter

อ้างถึงจาก: เทมาเส็ก ใน 22 มีนาคม 2011, 20:28:32
class-database.php

<?php

require_once 'class-tool.php';

class 
database_app {    

    private 
$tool;

    private 
$config;

    private 
$link;



    public function 
__construct(){

        
$this->tool = new tool_app();

        
$this->config $this->tool->request_config();

        
$this->connect_database();

    }



    public function 
connect_database(){

        
$this->link mysql_connect($this->config['db']['host'], $this->config['db']['user'], $this->config['db']['pass']);

        
mysql_query("USE {$this->config['db']['name']}"$this->link);

        
mysql_query("SET NAMES utf8"$this->link);

    }

?>



คุณลืม ปีกกา ตัวสุดท้ายของคลาสนี้หรือเปล่าลองเช็คดูนะ
Mubaza Thailand

เทมาเส็ก

ไม่ลืมครับใช้ netbeans เช็คแล้ว

เทมาเส็ก

อ้างถึงจาก: aum_mix ใน 22 มีนาคม 2011, 20:31:28
auto-config.php

เพิ่ม

include("class-database.php");

ยังไม่ได้อยู่ดีอ่ะครับ
ตอนนี้กลายเป็นแบบนี้ล่ะครับ
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/com12317/public_html/nongfang/class-database.php on line 1

Synchronize

เติม } (ปีกกาปิด) ในไฟล์  class-database.php  ดูก่อนครับ มันหายไปอันนึง

ใส่ก่อน   ?>  ครับ

  :wanwan017:
เนื้อหาความรู้น่าสนใจ ใหม่ๆ
[direct=https://develop.un-no.com/w3/docs/clear-float-in-div]เทคนิคการแก้ไขปัญหาจากการ float ซ้อน float แล้ว clear[/direct]

[direct=https://service.un-no.com/unbbz]ทำเว็บได้ด้วยตัวเองฟรี ด้วยระบบเว็บสำเร็จรูป unbbz , เว็บธรรมดา , เว็บบอร์ด , เว็บขายของ ทำได้หมดเลย[/direct]

เทมาเส็ก

ยังคงเป็นเหมือนเดิมคร้าบปวดหัวมากมาย :'(

เทมาเส็ก

งงไปหมดละครับท่านใดทราบช่วยที
hostgator ก็เป็น
hostnine ก็เป็น
ตอนนี้ระบบเลยรวนทำอะไรไม่ได้เลยครับ
เพราะไฟล์ database รวนด้วยอ่ะครับ :wanwan035: