如何解决数组到字符串的转换问题

时间:2015-09-17 08:34:02

标签: php string

有趣的问题:数组转换为字符串 我的代码中没有字符串。只是在页面上只有ara 3 mysql_query(" SELECT * FROM ...)...



<?php

$sorgu = mysql_query("SELECT * FROM genel_google") or die(mysql_error());

$cek = mysql_fetch_array($sorgu);

$title = $cek=['title'];

$aciklama = $cek=['aciklama'];

$anahtar = $cek=['anahtar'];

echo $title;

?>
&#13;
&#13;
&#13;

2 个答案:

答案 0 :(得分:0)

用于为变量分配db值的语法是错误的,而是尝试:

<?php

    $sorgu = mysql_query("SELECT * FROM genel_google") or die(mysql_error());
    $cek = mysql_fetch_array($sorgu);
    $title = $cek['title'];
    $aciklama = $cek['aciklama'];
    $anahtar = $cek['anahtar'];

    echo $title;

?>

答案 1 :(得分:0)

$title = $cek=['title'];

$title现在是array('title');,当你回应它时,你正在将数组转换为字符串..

您不应放置=来访问数组数据:

$title = $cek['title'];
$aciklama = $cek['aciklama'];
$anahtar = $cek['anahtar'];