<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Bilgisayar &#187; veritabani</title>
	<atom:link href="https://www.bilgisayar.me/index.php/tag/veritabani/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.bilgisayar.me</link>
	<description></description>
	<lastBuildDate>Wed, 29 Aug 2018 20:31:06 +0000</lastBuildDate>
	<language>tr-TR</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.2.29</generator>
	<item>
		<title>PHP ile MYSQL veritabanı bağlantıları</title>
		<link>https://www.bilgisayar.me/index.php/2015/07/24/php-ile-mysql-veritabani-baglantilari/</link>
		<comments>https://www.bilgisayar.me/index.php/2015/07/24/php-ile-mysql-veritabani-baglantilari/#comments</comments>
		<pubDate>Fri, 24 Jul 2015 19:45:30 +0000</pubDate>
		<dc:creator><![CDATA[Hakan Atılgan]]></dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[veritabani]]></category>

		<guid isPermaLink="false">http://www.bilgisayar.me/?p=1240</guid>
		<description><![CDATA[MYSQL veritabanı bağlantıları]]></description>
				<content:encoded><![CDATA[<p>MYSQL veritabanı bağlantıları</p>
<h3>mysql API (mysql zaman aşımına uğradıgından dolayı yerine mysqli API kullanın)</h3>
<pre class="prettyprint linenums" >
&lt;?php
 $host=&quot;localhost&quot;; // yerel bilgisayar için &#039;localhost&#039; veya &#039;127.0.0.1&#039;
 $kullaniciadi=&quot;Veritabanı kullanici adı&quot;;
 $sifre=&quot;Veritabanı şifresi&quot;;
 $veritabani= &quot;Veritabanı ismi&quot;;
 $connection=mysql_connect($host,$kullaniciadi,$sifre) or die(&quot;Veritabanı bağlantı hatası oluştu&quot;);
 
 $result=mysql_select_db($veritabani) or die(&quot;veritabani bulunamıdı&quot;);
?&gt;
</pre>
<h3>mysqli API (geliştirilmiş mysql)</h3>
<pre class="prettyprint linenums" >
&lt;?php
$host=&quot;localhost&quot;; // yerel bilgisayar için &#039;localhost&#039; veya &#039;127.0.0.1&#039;
$kullaniciadi=&quot;Veritabanı kullanici adı&quot;;
$sifre=&quot;Veritabanı şifresi&quot;;
$veritabani= &quot;Veritabanı ismi&quot;;

/* Veritabanı bağlantı parametreleri ile yeni bir mysqli nesnesi oluştur */
$mysqli = new mysqli($host, $kullaniciadi, $sifre, $veritabani);
if(mysqli_connect_errno()) {
    echo &quot;Hata oluştu: &quot; . mysqli_connect_errno();
    exit();
}
?&gt;
</pre>
<p>mysqli sorgulama örneği:</p>
<pre class="prettyprint linenums" >
&lt;?php
$sql = &quot;SELECT no,isim FROM kullanici&quot;;
$sonuc = $mysqli-&gt;query($sql);
while ($nt = $sonuc-&gt;fetch_array()){
    echo $nt[&#039;no&#039;].&#039; &#039;.$nt[&#039;isim&#039;].&#039;&lt;BR /&gt;&#039;;
}
// Döndürülen satır sayısı
echo &#039;Toplam: &#039;.$sonuc-&gt;num_rows.&#039; eleman bulundu.&#039;;
// Etkilenen satırların sayısı
echo &#039;Toplam: &#039;.$sonuc-&gt;affected_rows.&#039; eleman bulundu.&#039;;
?&gt;
</pre>
<h3>PDO API (PHP Data Objects &#8211; PHP Veri Nesneleri)</h3>
<pre class="prettyprint linenums" >
&lt;?php
$hostname=&quot;localhost&quot;; // yerel bilgisayar için &#039;localhost&#039; veya &#039;127.0.0.1&#039;
$kullaniciadi=&quot;Veritabanı kullanici adı&quot;;
$sifre=&quot;Veritabanı şifresi&quot;;
$veritabani= &quot;Veritabanı ismi&quot;; // 
try {
    $dbh = new PDO(&quot;mysql:host=$hostname;dbname=$veritabani&quot;, $kullaniciadi, $sifre);
    $sql = &quot;SELECT * FROM otomobil&quot;;
    foreach ($dbh-&gt;query($sql) as $row)
    {
        print $row[&#039;otomobil_model&#039;] .&#039; - &#039;. $row[&#039;otomobil_yil&#039;] . &#039;&lt;br /&gt;&#039;;
    }
    $dbh = null;
}
catch(PDOException $e)
{
    echo $e-&gt;getMessage();
}
?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>https://www.bilgisayar.me/index.php/2015/07/24/php-ile-mysql-veritabani-baglantilari/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
