I am in prototype stage with my site.
Since prepared statements are more secure & the new way to talk with mysql db, I decided to use them and read the related sections in php.net but all examples in php.net are given with placeholders like where name = ?
.
Below I need no placeholder I suppose but I couldn't achieve printing my output.
I have no output from my db.
I have notices that are:
Notice: Undefined variable: row in ... on line 16
Notice: Undefined variable: row in ... on line 16
Notice: Undefined variable: row in ... on line 16
Notice: Undefined variable: row in ... on line 16
What should I do? Can you help me please.
Thank you, regards
in my index.php
//mysql bağlantısı
global $db_baglanti;
$db_baglanti = new mysqli(vt_host, vt_user, vt_password, vt_name);
if ($db_baglanti->connect_errno)
{
echo "MySQL bağlantısı kurulamadı: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
if (!$db_baglanti->set_charset("utf8"))
{
printf("utf8 karakter setinin yüklenmesinde problem oluştu: %s\n", $db_baglanti->error);
}
else
{
$db_baglanti->set_charset("utf8");
}
in an included page
$sorgum = "SELECT kolon_baslik, kolon_yazi FROM tb_yazilar";
if ($beyan = $db_baglanti->prepare($sorgum))
{
/* execute statement */
$beyan->execute();
/* fetch values */
while ($beyan->fetch()) {
echo $row['kolon_baslik'].'<br /><br />'.$row['kolon_yazi'].'<br /><br />';
}
/* close statement */
$beyan->close();
}