[英]Trying to fetch data from mysql but only the first character for each field is loaded. Works Locally but not online
Im trying to fetch data from mysql but only the first character for each field is loaded. 我试图从mysql获取数据,但每个字段仅加载第一个字符。 However this only happens when I upload my site to my domain.
但是,只有当我将网站上传到我的域时,才会发生这种情况。 On localhost it works fine.
在本地主机上工作正常。 So i can only assume its a server issue?
所以我只能假设它是服务器问题?
my Query is: 我的查询是:
$stmt = $mysqli->prepare("SELECT Prd_ID, product_title, model_no, part_no, category_id, subcat_id, weights, ean, condition_id, brand_id, warranty_id, collect_serial, retail, listprice, short_desc, full_desc, tax_class_id, web_status_id FROM product WHERE Prd_ID = ?");
$stmt->bind_param("s", $_GET['pid'] );
$stmt->store_result();
$stmt->bind_result($pid, $product_title, $model_no, $part_no, $category_id, $subcat_id, $weights, $ean, $condition_id, $brand_id, $warranty_id, $collect_serial, $retail, $listprice, $short_desc, $full_desc, $tax_class_id, $web_status_id);
if( $stmt->execute() ) {
// Loads of code.. to much to paste here
}
i have used the following to see the output on both localhost and domain online: 我已经使用以下内容查看本地主机和域上的输出:
print_r(get_defined_vars(),true);
The following are the results i got. 以下是我得到的结果。
Localhost 本地主机
[pid] => 5
[product_title] => HP Envy 15-J140SA Intel Core i5-4200M 8GB 1TB Nvidia GT840 2GB Windows 8.1
[model_no] => 15-J140SA
[part_no] => J0B97EA
[category_id] => 1
[subcat_id] => 2
[weights] => 2.50
[ean] => 0888793319512
[condition_id] => 4
[brand_id] => 19
[warranty_id] => 3
[collect_serial] => 2
[retail] => 599.99
[listprice] => 499.99
[short_desc] =>
[full_desc] =>
[tax_class_id] => 1
[web_status_id] => 2
[row] => 1
)
Online 线上
[pid] => 5
[product_title] => H
[model_no] => 1
[part_no] => J
[category_id] => 1
[subcat_id] => 2
[weights] => 2
[ean] => 0
[condition_id] => 4
[brand_id] => 19
[warranty_id] => 3
[collect_serial] => 2
[retail] => 5.00
[listprice] => 4.00
[short_desc] =>
[full_desc] =>
[tax_class_id] => 1
[web_status_id] => 2
[row] => 1
)
The PHP code is a carbon copy on both sides. PHP代码两面都是副本。 (localhost and online) and the databases are the same as well.
(本地主机和在线)和数据库也相同。 I've been banging my head tryna figure this out.
我一直在努力尝试解决这个问题。 I'd like to know if this is a server problem since it works fine on localhost.
我想知道这是否是服务器问题,因为它可以在localhost上正常工作。
Thanks in advance. 提前致谢。
EDIT: 编辑:
$row = $stmt->fetch();
if( $pid == $_GET['pid'] ){
// Pre-load details
$isCopy = true;
$product_title = $product_title;
$model_no = $model_no;
$part_no = $part_no;
$category_id = $category_id;
$subcat_id = $subcat_id;
$weights = $weights;
$ean = $ean;
$condition_id = $condition_id;
$brand_id = $brand_id;
$warranty_id = $warranty_id;
$collect_serial = $collect_serial;
$retail = number_format($retail, 2);
$listprice = number_format($listprice, 2);
$short_desc = $short_desc;
$full_desc = $full_desc;
$tax_class_id = $tax_class_id;
$web_status_id = $web_status_id;
$stmt->close();
}
Solved it. 解决了。 Removed the $full_desc from the paramaters and it worked.
从参数中删除了$ full_desc,它起作用了。 I dont know why it was this particular field and nothing else.
我不知道为什么是这个特定领域,仅此而已。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.