สอบถามเชื่อมต่อกับ File joomla ไม่ได้

Post a reply

Smilies
:icon_plusone: :like: :plusone: :gfb: :-D :) :( :-o 8O :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: :angry: :baa: :biggrin:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: สอบถามเชื่อมต่อกับ File joomla ไม่ได้

Re: สอบถามเชื่อมต่อกับ File joomla ไม่ได้

by thatsawan » 05/02/2017 3:08 pm

ปัญหามาจาก เขียนใน php 7 ต้องแก้ไข connect ค่ะ

หรือจะดักด้วยตัวแปล เช็คเวอร์ชั่น php ก่อนก็ได้ค่ะ

Code: Select all

phpversion(); 

Code: Select all

$con = mysqli_connect("localhost","my_user","my_password","my_db");

// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  } 

Re: สอบถามเชื่อมต่อกับ File joomla ไม่ได้

by Pongsak Keaononpho » 05/02/2017 2:08 pm

JConfig Object ( [offline] => 0 [offline_message] => This site is down for maintenance.
Please check back again soon. [display_offline_message] => 1 [offline_image] => [sitename] => m039mindphp [editor] => tinymce [captcha] => 0 [list_limit] => 20 [access] => 1 [debug] => 0 [debug_lang] => 0 [dbtype] => mysqli [host] => localhost [user] => root [password] => [db] => m039 [dbprefix] => tx4th_ [live_site] => [secret] => mGZ848GMFKFFDiVC [gzip] => 0 [error_reporting] => default [helpurl] => https://help.joomla.org/proxy/index.php ... r}:{keyref} [ftp_host] => [ftp_port] => [ftp_user] => [ftp_pass] => [ftp_root] => [ftp_enable] => 0 [offset] => UTC [mailonline] => 1 [mailer] => mail [mailfrom] => m039.ติดต่อทาง pm [fromname] => m039mindphp [sendmail] => /usr/sbin/sendmail [smtpauth] => 0 [smtpuser] => [smtppass] => [smtphost] => localhost [smtpsecure] => none [smtpport] => 25 [caching] => 0 [cache_handler] => file [cachetime] => 15 [cache_platformprefix] => 0 [MetaDesc] => m039mindphp [MetaKeys] => [MetaTitle] => 1 [MetaAuthor] => 1 [MetaVersion] => 0 [robots] => [sef] => 1 [sef_rewrite] => 0 [sef_suffix] => 0 [unicodeslugs] => 0 [feed_limit] => 10 [feed_email] => none [log_path] => C:\xampp\htdocs\m039mindphp\administrator/logs [tmp_path] => C:\xampp\htdocs\m039mindphp/tmp [lifetime] => 15 [session_handler] => database )
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\m039mindphp\Ex-1-Form\connect.php:14 Stack trace: #0 C:\xampp\htdocs\m039mindphp\Ex-1-Form\form.php(3): require_once() #1 {main} thrown in C:\xampp\htdocs\m039mindphp\Ex-1-Form\connect.php on line 14

Re: สอบถามเชื่อมต่อกับ File joomla ไม่ได้

by Pongsak Keaononpho » 05/02/2017 2:07 pm

mindphp wrote:ลอง print_r($joomlaconfig)
ดูว่ามีค่าจาก Joomla เข้ามาไหมครับ
JConfig Object ( [offline] => 0 [offline_message] => This site is down for maintenance.
Please check back again soon. [display_offline_message] => 1 [offline_image] => [sitename] => m039mindphp [editor] => tinymce [captcha] => 0 [list_limit] => 20 [access] => 1 [debug] => 0 [debug_lang] => 0 [dbtype] => mysqli [host] => localhost [user] => root [password] => [db] => m039 [dbprefix] => tx4th_ [live_site] => [secret] => mGZ848GMFKFFDiVC [gzip] => 0 [error_reporting] => default [helpurl] => https://help.joomla.org/proxy/index.php ... r}:{keyref} [ftp_host] => [ftp_port] => [ftp_user] => [ftp_pass] => [ftp_root] => [ftp_enable] => 0 [offset] => UTC [mailonline] => 1 [mailer] => mail [mailfrom] => m039.ติดต่อทาง pm [fromname] => m039mindphp [sendmail] => /usr/sbin/sendmail [smtpauth] => 0 [smtpuser] => [smtppass] => [smtphost] => localhost [smtpsecure] => none [smtpport] => 25 [caching] => 0 [cache_handler] => file [cachetime] => 15 [cache_platformprefix] => 0 [MetaDesc] => m039mindphp [MetaKeys] => [MetaTitle] => 1 [MetaAuthor] => 1 [MetaVersion] => 0 [robots] => [sef] => 1 [sef_rewrite] => 0 [sef_suffix] => 0 [unicodeslugs] => 0 [feed_limit] => 10 [feed_email] => none [log_path] => C:\xampp\htdocs\m039mindphp\administrator/logs [tmp_path] => C:\xampp\htdocs\m039mindphp/tmp [lifetime] => 15 [session_handler] => database )
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\m039mindphp\Ex-1-Form\connect.php:14 Stack trace: #0 C:\xampp\htdocs\m039mindphp\Ex-1-Form\form.php(3): require_once() #1 {main} thrown in C:\xampp\htdocs\m039mindphp\Ex-1-Form\connect.php on line 14

Re: สอบถามเชื่อมต่อกับ File joomla ไม่ได้

by mindphp » 04/02/2017 8:07 pm

ลอง print_r($joomlaconfig)
ดูว่ามีค่าจาก Joomla เข้ามาไหมครับ

สอบถามเชื่อมต่อกับ File joomla ไม่ได้

by aepongsak1 » 04/02/2017 6:59 pm

Code: Select all

<?php

require_once '../configuration.php';

$joomlaconfig = new JConfig();

$host = $joomlaconfig->host;
$username = $joomlaconfig->user;
$password = $joomlaconfig->password;
$db = $joomlaconfig->db;

mysql_connect($host, $username, $password) or die('connnect Failed');
mysql_query('set names utf8');
mysql_select_db($db) or die('Select DB Failed');


 ?>

Error


Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\Ex-1-Form\connect.php:12 Stack trace: #0 C:\xampp\htdocs\Ex-1-Form\form.php(3): require_once() #1 {main} thrown in C:\xampp\htdocs\Ex-1-Form\connect.php on line 12

Code: Select all

echo $joomlaconfig;
Recoverable fatal error: Object of class JConfig could not be converted to string in C:\xampp\htdocs\Ex-1-Form\connect.php on line 7

Top