Jump to content

Mysql Bağlantı Nasıl Yapılır ?


muratboy31
 Share

Recommended Posts

Merhaba arkadaşlar,

 

Aşağıdaki kodu herhangi bir veri yazmak için kullanıyorum ama hata veriyor ;

 

MySQLConnection, err = MySQL:connect("denemedb", "user", "pass", "172.16.1.2");
 
a = Input.GetText("adi");
b = Input.GetText("soyadi");
c = Input.GetText("cihaz");
d = Input.GetText("marka");
e = Input.GetText("model");
f = Input.GetText("seri");
 
MysqlQuery = MySQLConnection:execute("INSERT INTO "..demirbas.."(\""..adi.."\",\""..soyadi.."\",\""..cihaz.."\",\""..marka.."\",\""..model.."\",\""..seri.."\") VALUES ("..a..","..b..","..c..","..d..","..e..","..f..")");
 
Dialog.Message("Başarılı !", "Bilgi Eklendi!", MB_OK, MB_ICONINFORMATION)
Page.Jump("Giris");

 

28997vc.jpg

 

 

9h2k48.jpg

Link to comment
Share on other sites

1. si "172.16.1.2" bu IP adresi yerel ağ değilde bir web sitesine ait ise Remote MySQL açık olmalıdır. 

 

2. si ise VALUES ("..a..","..b..","..c..","..d..","..e..","..f..")"); şeklinde değil VALUES ('"..a.."','"..b.."','"..c.."','"..d.."','"..e.."','"..f.."')"); şeklinde olmalı. yani ' ' ları unutmuşsunuz.

Link to comment
Share on other sites

Evet local de çalışıyorum, ayrıca bu şekilde denedim yine aynı hatayı verdi !

 

MysqlQuery = MySQLConnection:execute("INSERT INTO "..demirbas.."(\""..adi.."\",\""..soyadi.."\",\""..cihaz.."\",\""..marka.."\",\""..model.."\",\""..seri.."\") VALUES ('"..a.."','"..b.."','"..c.."','"..d.."','"..e.."','"..f.."')");

Link to comment
Share on other sites

  • Editor

O şekilde olmayacak

 

MysqlQuery = MySQLConnection:execute("INSERT INTO tabloadi(adi,soyadi,cihaz.,marka,model,seri) VALUES ('"..a..'",'"..b.."','"..c.."','"..d.."','"..e.."','"..f.."')");

Link to comment
Share on other sites

Ufak bir sorum daha var arkadaşlar,

 

Aynı veri tabanına farklı bir tablo daha ekledim ama içine herhangi bir veri yazamıyorum, aslında hata vermiyor ama veride yazılmıyor !

 

MySQLConnection, err = MySQL:connect("deneme", "user", "pass", "172.16.1.2");
 
yeni = Input.GetText("yeni_cihaz");

 
MysqlQuery = MySQLConnection:execute("INSERT INTO cihazlar(cihaz) VALUES ('"..yeni.."')");
 
Dialog.Message("Eklenedi!", "Cihaz Eklendi!", MB_OK, MB_ICONINFORMATION)
Page.Jump("Page1");

 

 

2hs3y8x.jpg

Edited by muratboy31
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...