Posts Tagged ‘php’

Bu örnekte _swedish_ci karekter setindeki bir veritabanını _turkish_ci setine çeviriyoruz. Kullanmadan önce yedek almayı unutmayın!


<?

$host = "localhost";
$user = "root";
$pass = "password";
$db =   "database";

_connect($host, $user, $pass);
mysql_select_db($db);

$eski = ’utf8_swedish_ci‘;
$yeni = ’utf8_turkish_ci‘;
$cset = ’utf8‘;

function sorgula($sql) {
    $rs = mysql_query($sql);
    if (!$rs) {
        $message  = ’Hata: ‘ . mysql_error() . "\n<br>";
        $message .= ’Sorgu: ‘ . $sql . "\n<br>";
        die($message);
    }
    return $rs;
}

$tablolar = sorgula("SHOW TABLES");
$html  = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>";
$html .= "<meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\" /></head>";

print $html. ’<body><pre>‘;

while ($sutunlar = mysql_fetch_row($tablolar)) {
    $table = mysql_real_escape_string($sutunlar[0]);
    sorgula("ALTER TABLE `$table` DEFAULT CHARACTER SET $cset");
    echo "$table $cset e dönüştü! \r\n";
    $rs = sorgula(" SHOW FULL FIELDS FROM `$table` ");
    while ($sutun=mysql_fetch_assoc($rs)) {
        if ($sutun['Collation']!=$eski)
            continue;
        $field = mysql_real_escape_string($sutun['Field']);
        sorgula ("ALTER TABLE `$table` CHANGE `$field` `$field` $sutun[Type] CHARACTER SET $cset COLLATE $yeni");
        echo "$table tablosu $field alani $yeni karekter setine dönüştürüldü\r\n";
    }
}
print "</pre></body></html>";
?>

Bookmark and Share
Tags: , , ,

Tags: , , ,

25
Feb

netbeans ile php debug

   Posted by: İsmail ÇAKIR    in php

idesinde kodlarınıza yapmak isterseniz;

paketini kurun

sudo apt-get install php5-xdebug

daha sonra

/etc/php5/apache2/php.ini dosyasını editleyip aşağıdaki satıları ekleyin;

xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000

apacheyi restart edip hatalarınızı bulmaya başlıyabilirsiniz.

Bookmark and Share
Tags: , , , ,

Tags: , , , ,

18
Jan

php ile base64 kodlamak ve çözmek

   Posted by: Muhammed YÜRÜRDURMAZ    in Uncategorized


<?
echo _encode ( "deneme metni" );
echo "\n";
echo base64_decode ( "ZGVuZW1lIG1ldG5p" );?>

Bookmark and Share
Tags: , ,

Tags: , ,

18
Jan

php faktöriyel hesaplama

   Posted by: Muhammed YÜRÜRDURMAZ    in Uncategorized

öğrencilere ve yeni öğrenenlere basit bir örnek

<?
function faktor($i){
if($i != 0) return $i * faktor($i-1);
return 1;
}
echo faktor(5);?>

Denemek için http://codepad.org/EMjpGZ4y

Bookmark and Share
Tags: , ,

Tags: , ,

25
Nov

Codepad

   Posted by: myururdurmaz    in Uncategorized

Küçük uygulamalar veya scriptler yazıp test etmek istiyorsanız bu site tam size göre.

http://codepad.org/irV8v8fe

http://codepad.org/

Bookmark and Share
Tags: , , , , , , , , , , ,

Tags: , , , , , , , , , , ,

21
Jun

few links to advance your php programming

   Posted by: İsmail ÇAKIR    in php, Yazılım

Ahanda şunlar;

  • Link 1
  • Link 2
  • Link 3
  • Link 4
  • Link 5
  • Bookmark and Share
    Tags:

    Tags:

    Switch to our mobile site