-2

interesting problem: Array to string conversion in bu there is no string in my code. just only yhere ara 3 mysql_query("SELECT * FROM ... ) in on page...

<?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;

?>

2 Answers2

0

The syntax you use to assign variables with db values is wrong, instead try:

<?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;

?>
Professor Abronsius
  • 33,063
  • 5
  • 32
  • 46
0
$title = $cek=['title'];

$title is now array('title');, when you echo that, you are converting an array to a string..

you shouldn't place the = to access array data:

$title = $cek['title'];
$aciklama = $cek['aciklama'];
$anahtar = $cek['anahtar'];
NDM
  • 6,731
  • 3
  • 39
  • 52