doutao1282 2015-07-07 18:15
浏览 28

尝试从mysql中获取数据,但只加载每个字段的第一个字符。 在本地工作但不在线

Im trying to fetch data from mysql but only the first character for each field is loaded. 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. (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.

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();

        }
  • 写回答

1条回答 默认 最新

  • duandai6373 2015-07-08 02:48
    关注

    Solved it. Removed the $full_desc from the paramaters and it worked. I dont know why it was this particular field and nothing else.

    评论

报告相同问题?

悬赏问题

  • ¥15 ogg dd trandata 报错
  • ¥15 高缺失率数据如何选择填充方式
  • ¥50 potsgresql15备份问题
  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错