简体   繁体   English

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

[英]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.

相关问题 带有Google Maps的MySQL和MySQL-数据源仅在本地工作,而无法从http网址访问 - MySQL and PHP with Google Maps - Data source only works locally not when accessing from an http url MySQL只返回字段的第一个字符,但在本地工作正常 - MySQL returns only the first character of the fields, but works fine on local PHP脚本仅在Safari中不起作用(仅在线-在本地进行测试) - Php script not working in Safari only (online only - it works locally for testing) 显示mysql查询的内容,只有第一个字段有效 - displaying the contents of a mysql query, only first field works 从mysql取数据到android中的列表视图仅显示表中的第一项如何解决? - fetch data from mysql to a list view in android only show the first item from the table how to fix? 使用 PHP 从 mysql 获取数据到 JSON 可以在本地运行,但不能在服务器上运行 - Getting data from mysql into JSON using PHP works locally but not on server 仅加载资源。 活动在FullCalendar中不起作用 - Resources only loaded. Events not working in FullCalendar 如何获取26行MySQL数据,但仅显示前25行 - How To Fetch 26 Rows of MySQL Data, But Display It Only First 25 MySQL仅插入第一个字符 - MySQL inserts only first character 从 MySQL 数据库中提取数据并在列中仅提取每个值的 1 个值,然后首先显示最新的 - Pulling data from MySQL database and pulling only 1 value of each in a column and then show latest first
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM