Mengganti Text Form dengan PHP MYSQL Script creator oleh Aang
Mengganti warna background menjadi silver
Menambahkan 3 button yaitu button copy script, Ulangi, dan Simpan Script, lihat gambar dibawah:
Setelah menambahkan 3 button seperti gambar diatas langkah selanjutnya adalah mengganti semua kode yang sudah dibuat dengan kode dibawah:
Public Class Form1
Private Sub RichTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged
If RichTextBox1.Text = "" Then
RichTextBox1.Text = "<?php" & vbNewLine
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
RichTextBox1.Text = RichTextBox1.Text & vbNewLine & "$konak=mysql_connect('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "');" & vbNewLine
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
RichTextBox1.Text = RichTextBox1.Text & "mysql_select_db('" & TextBox4.Text & "',$konak);" & vbNewLine
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
If Not RichTextBox1.Text.Contains("mysql_connect") And ComboBox1.Text = "Insert" Then
RichTextBox1.Text = "<?php" & vbNewLine & "if isset($_POST['Submit'])){" & vbNewLine & "mysql_query(" & """Insert into "
TextBox5.Visible = True
Button3.Visible = True
ElseIf Not RichTextBox1.Text.Contains("mysql_connect") And ComboBox1.Text = "Update" Then
RichTextBox1.Text = "<?php" & vbNewLine & "$id2=$_GET['id'];" & vbNewLine & " if (isset($_GET['id'])){" & vbNewLine & "if isset($_POST['Submit'])){" & vbNewLine & "mysql_query(" & """Update "
TextBox5.Visible = True
Button3.Visible = True
TextBox6.Visible = False
ElseIf Not RichTextBox1.Text.Contains("mysql_connect") And ComboBox1.Text = "Delete" Then
RichTextBox1.Text = "<?php" & vbNewLine & "$id2=$_GET['id'];" & vbNewLine & " if (isset($_GET['id'])){" & vbNewLine & "if isset($_POST['Submit'])){" & vbNewLine & "mysql_query(" & """Delete from "
TextBox5.Visible = True
Button3.Visible = True
TextBox6.Visible = False
ElseIf Not RichTextBox1.Text.Contains("mysql_connect") And ComboBox1.Text = "Select" Then
RichTextBox1.Text = "<?php" & vbNewLine & "$id2=$_GET['id'];" & vbNewLine & " if (isset($_GET['id'])){" & vbNewLine & "$result=mysql_query(" & """Select * from "
TextBox5.Visible = True
Button3.Visible = True
TextBox6.Visible = False
ElseIf Not RichTextBox1.Text.Contains("mysql_connect") And ComboBox1.Text = "Select While" Then
RichTextBox1.Text = "<?php" & vbNewLine & "$id2=$_GET['id'];" & vbNewLine & "$result=mysql_query(" & """Select * from "
TextBox5.Visible = True
Button3.Visible = True
TextBox6.Visible = False
ElseIf RichTextBox1.Text.Contains("mysql_connect") And ComboBox1.Text = "Insert" Then
RichTextBox1.Text = RichTextBox1.Text & "if isset($_POST['Submit'])){" & vbNewLine & "mysql_query(" & """Insert into "
TextBox5.Visible = True
Button3.Visible = True
ElseIf RichTextBox1.Text.Contains("mysql_connect") And ComboBox1.Text = "Update" Then
RichTextBox1.Text = RichTextBox1.Text & "$id2=$_GET['id'];" & vbNewLine & " if (isset($_GET['id'])){" & vbNewLine & "if isset($_POST['Submit'])){" & vbNewLine & "mysql_query(" & """Update "
TextBox5.Visible = True
Button3.Visible = True
TextBox6.Visible = False
ElseIf RichTextBox1.Text.Contains("mysql_connect") And ComboBox1.Text = "Delete" Then
RichTextBox1.Text = RichTextBox1.Text & "$id2=$_GET['id'];" & vbNewLine & " if (isset($_GET['id'])){" & vbNewLine & "if isset($_POST['Submit'])){" & vbNewLine & "mysql_query(" & """Delete from "
TextBox5.Visible = True
Button3.Visible = True
TextBox6.Visible = False
ElseIf RichTextBox1.Text.Contains("mysql_connect") And ComboBox1.Text = "Select" Then
RichTextBox1.Text = RichTextBox1.Text & "$id2=$_GET['id'];" & vbNewLine & " if (isset($_GET['id'])){" & vbNewLine & vbNewLine & "$result=mysql_query(" & """Select * from "
TextBox5.Visible = True
Button3.Visible = True
TextBox6.Visible = False
ElseIf RichTextBox1.Text.Contains("mysql_connect") And ComboBox1.Text = "Select While" Then
RichTextBox1.Text = RichTextBox1.Text & "$id2=$_GET['id'];" & vbNewLine & "$result=mysql_query(" & """Select * from "
TextBox5.Visible = True
Button3.Visible = True
TextBox6.Visible = False
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If ComboBox1.Text = "Insert" Then
RichTextBox1.Text = RichTextBox1.Text & TextBox5.Text & "("
Button3.Visible = False
Label6.Text = "Kolom"
Button4.Visible = True
ElseIf ComboBox1.Text = "Update" Then
RichTextBox1.Text = RichTextBox1.Text & " " & TextBox5.Text & " SET "
Button3.Visible = False
Label6.Text = "Kolom"
Button4.Visible = True
ElseIf ComboBox1.Text = "Delete" Then
RichTextBox1.Text = RichTextBox1.Text & " " & TextBox5.Text & " Where id=$id2"");" & vbNewLine & "}" & vbNewLine & "}" & vbNewLine & "?>" & vbNewLine
Button3.Visible = False
Label6.Text = "Kolom"
Button4.Visible = True
TextBox4.Visible = False
TextBox5.Visible = False
Button4.Visible = False
Button5.Visible = False
Button6.Visible = True
ElseIf ComboBox1.Text = "Select" Then
RichTextBox1.Text = RichTextBox1.Text & " " & TextBox5.Text & " Where id=$id2"");" & vbNewLine & "$hasil=mysql_fetch_array($result);" & vbNewLine
Button3.Visible = False
Label6.Text = "Kolom"
Button4.Visible = True
TextBox4.Visible = True
TextBox5.Visible = True
Button5.Visible = False
Button6.Visible = True
ElseIf ComboBox1.Text = "Select While" Then
RichTextBox1.Text = RichTextBox1.Text & " " & TextBox5.Text & """);" & vbNewLine
Button3.Visible = False
Label6.Text = "Kolom"
Button4.Visible = True
TextBox4.Visible = True
TextBox5.Visible = True
Button5.Visible = False
Button6.Visible = True
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
If Label6.Text = "Kolom" And ComboBox1.Text = "Insert" Then
RichTextBox1.Text = RichTextBox1.Text & TextBox5.Text
TextBox5.Visible = False
TextBox6.Visible = True
Button4.Visible = False
Button5.Visible = True
Button6.Visible = True
ElseIf Label6.Text = "Kolom" And ComboBox1.Text = "Update" Then
RichTextBox1.Text = RichTextBox1.Text & TextBox5.Text & "='$_POST[" & TextBox5.Text & "]'"
RichTextBox2.Text = RichTextBox2.Text & "<form action='' method=''>" & vbNewLine & "<input name='" & TextBox5.Text & "'>"
TextBox5.Visible = False
TextBox6.Visible = True
Button4.Visible = False
Button5.Visible = True
Button6.Visible = True
ElseIf Label6.Text = "Kolom" And ComboBox1.Text = "Select" Then
RichTextBox1.Text = RichTextBox1.Text & "$" & TextBox5.Text & "=$hasil['" & TextBox5.Text & "'];" & vbNewLine
RichTextBox2.Text = RichTextBox2.Text & "<? echo $" & TextBox5.Text & "; ?><hr>" & vbNewLine
TextBox6.Visible = False
Button4.Visible = False
Button5.Visible = True
Button6.Visible = True
ElseIf Label6.Text = "Kolom" And ComboBox1.Text = "Select While" Then
RichTextBox1.Text = RichTextBox1.Text & "while($" & TextBox5.Text & "=mysql_fetch_array($result)){" & vbNewLine & "?>" & vbNewLine
TextBox6.Visible = True
Button4.Visible = False
Button5.Visible = True
Button6.Visible = True
Else
RichTextBox1.Text = RichTextBox1.Text & "'$_POST[" & TextBox5.Text & "]'"
RichTextBox2.Text = RichTextBox2.Text & "<form action='' method='POST'>" & vbNewLine & "<input name='" & TextBox5.Text & "'>"
TextBox5.Visible = False
TextBox6.Visible = True
Button4.Visible = False
Button5.Visible = True
Button6.Visible = True
End If
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
If Label6.Text = "Kolom" And RichTextBox1.Text.Contains("Insert") Then
RichTextBox1.Text = RichTextBox1.Text & "," & TextBox6.Text
ElseIf Label6.Text = "Values" And RichTextBox1.Text.Contains("Insert") Then
RichTextBox1.Text = RichTextBox1.Text & ",'$_POST[" & TextBox6.Text & "]'"
RichTextBox2.Text = RichTextBox2.Text & vbNewLine & "<input name='" & TextBox6.Text & "'>"
ElseIf Label6.Text = "Kolom" And RichTextBox1.Text.Contains("Update") Then
RichTextBox1.Text = RichTextBox1.Text & "," & TextBox6.Text & "='$_POST[" & TextBox6.Text & "]'"
RichTextBox2.Text = RichTextBox2.Text & vbNewLine & "<input name='" & TextBox6.Text & "'>"
ElseIf Label6.Text = "Kolom" And ComboBox1.Text = "Select" Then
RichTextBox1.Text = RichTextBox1.Text & "$" & TextBox5.Text & "=$hasil['" & TextBox5.Text & "'];" & vbNewLine
RichTextBox2.Text = RichTextBox2.Text & "<? echo $" & TextBox5.Text & "; ?><hr>" & vbNewLine
ElseIf Label6.Text = "Kolom" And ComboBox1.Text = "Select While" Then
RichTextBox2.Text = RichTextBox2.Text & "<? echo $" & TextBox5.Text & "['" & TextBox6.Text & "']; ?>" & vbNewLine
TextBox6.Visible = True
Button4.Visible = False
Button5.Visible = True
Button6.Visible = True
End If
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
If Label6.Text = "Kolom" And ComboBox1.Text = "Insert" Then
RichTextBox1.Text = RichTextBox1.Text & ") values ("
Label6.Text = "Values"
TextBox6.Visible = False
Button5.Visible = False
TextBox5.Visible = True
Button4.Visible = True
ElseIf Label6.Text = "Values" And ComboBox1.Text = "Insert" Then
RichTextBox1.Text = RichTextBox1.Text & ")" & """);" & vbNewLine & "echo 'Sukses';" & vbNewLine & "}" & vbNewLine & "?>" & vbNewLine
RichTextBox2.Text = RichTextBox2.Text & vbNewLine & "<input name='Submit' value='Masuk' type='submit'></form>"
RichTextBox1.Text = RichTextBox1.Text & RichTextBox2.Text
RichTextBox2.Clear()
Button6.Visible = False
TextBox6.Visible = False
TextBox5.Visible = False
TextBox4.Visible = True
Button5.Visible = False
Button4.Visible = False
Button3.Visible = False
ElseIf Label6.Text = "Kolom" And ComboBox1.Text = "Update" Then
RichTextBox1.Text = RichTextBox1.Text & " where id=$id2"");" & vbNewLine & "}" & vbNewLine & "}" & vbNewLine & "?>"
RichTextBox2.Text = RichTextBox2.Text & vbNewLine & "<input name='Submit' value='Masuk' type='submit'></form>"
RichTextBox1.Text = RichTextBox1.Text & RichTextBox2.Text
Button6.Visible = False
TextBox6.Visible = False
TextBox5.Visible = False
TextBox4.Visible = True
Button5.Visible = False
Button4.Visible = False
Button3.Visible = False
ElseIf Label6.Text = "Kolom" And ComboBox1.Text = "Delete" Then
RichTextBox2.Text = RichTextBox2.Text & vbNewLine & "<form action='' method='POST'><input name='Submit' value='Hapus' type='submit'></form>"
RichTextBox1.Text = RichTextBox1.Text & RichTextBox2.Text
Button6.Visible = False
TextBox6.Visible = False
TextBox5.Visible = False
TextBox4.Visible = True
Button5.Visible = False
Button4.Visible = False
Button3.Visible = False
ElseIf Label6.Text = "Kolom" And ComboBox1.Text = "Select" Then
RichTextBox1.Text = RichTextBox1.Text & "}" & vbNewLine & "?>"
RichTextBox1.Text = RichTextBox1.Text & RichTextBox2.Text
Button6.Visible = False
TextBox6.Visible = False
TextBox5.Visible = False
TextBox4.Visible = True
Button5.Visible = False
Button4.Visible = False
Button3.Visible = False
ElseIf Label6.Text = "Kolom" And ComboBox1.Text = "Select While" Then
RichTextBox2.Text = RichTextBox2.Text & "<?" & vbNewLine & "}" & vbNewLine & "?>"
RichTextBox1.Text = RichTextBox1.Text & RichTextBox2.Text
Button6.Visible = False
TextBox6.Visible = False
TextBox5.Visible = False
TextBox4.Visible = True
Button5.Visible = False
Button4.Visible = False
Button3.Visible = False
End If
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
My.Computer.Clipboard.SetText(RichTextBox1.Text)
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
Button6.Visible = False
TextBox6.Visible = False
TextBox5.Visible = False
TextBox4.Visible = True
Button5.Visible = False
Button4.Visible = False
Button3.Visible = False
RichTextBox1.Text = "<?php" & vbNewLine
RichTextBox2.Text = "<HTML>" & vbNewLine
TextBox5.Text = ""
TextBox6.Text = ""
End Sub
Dim sv As New SaveFileDialog
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
sv.Filter = "PHP File|*.php"
sv.Title = "Simpan File"
If sv.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim bikin As New System.IO.StreamWriter(sv.FileName, False)
bikin.WriteLine(RichTextBox1.Text)
bikin.Close()
End If
End Sub
End Class
0 comments:
Speak up your mind
Tell us what you're thinking... !