내 사이트에서 VirtueMart 구성 요소를 사용합니다.PHP 코드가 데이터베이스에서 데이터를 검색하지 못합니까?
<?php
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select all records from the user profile table where key begins with
//"custom.".
// Order it by the ordering field.
$query->select($db->quoteName(array('customfield_value',
'virtuemart_product_id')));
$query->from($db->quoteName('jos_virtuemart_product_customfields'));
$query->where($db->quoteName('virtuemart_custom_id') . ' LIKE '. $db-
>quote('3'). ' AND '. $db->quoteName('virtuemart_product_id') . 'LIKE ' .
$db->quote($product->virtuemart_product_id));
// Reset the query using our newly populated query object.
$db->setQuery($query);
// Load the results as a list of stdClass objects (see later for more
options on retrieving data).
$results = $db->loadResult();
echo ($results);
?>
그러나, 어떤 이유로,이 데이터를로드 아니에요 :
나는 Joomla를 3.6에서 실행되는 코드의 조각을 가지고있다. 빈 페이지가 생겼어. 내 localhost에서 그것은 잘 작동하지만 아직 내 라이브 사이트에서 전혀로드되지 않습니다.
왜 그런가? 동일한 데이터베이스 (phpmyadmin)를 사용하고 있습니다.
호스팅 문제가 있습니까?
잘 모르겠습니다. 나는 일주일 동안 모든 것을 오프라인으로 테스트했으며 모두가 순조롭게 진행되었다. 콘솔에 어떤 오류도 나타나지 않아서 무엇이 잘못 될 수 있는지 알지 못합니다.
읽어 주셔서 감사합니다.
줄 단위로 디버깅 해보십시오. – Akintunde007
감사합니다. 시도해 보겠습니다. 매우 이상하게 작동하지 않습니다. 서버로 생각 해보세요. – MailBlade