Now I will explain how to read data with PHP below is complete code: |
<?
// database connection
$conn= mysql_connect ("localhost","root","") or
die ("sorry wrong username or password");
$db = "dataku";
mysql_select_db($db, $conn);
// judul table
echo "<table border='1'>";
echo "<tr>";
echo "<td>nama</td><td>nim</td><td>jurusan</td>";
echo "</tr>";
// baca recordset
$sql="select nim,nama,jurusan from mahasiswa";
$rs = mysql_query($sql,$conn) or die ("Kesalahan pada pembacaan recordset");
for($i=0;$i<mysql_num_rows($rs);$i++){
$row_array=mysql_fetch_row($rs);
echo "<tr>";
echo "<td>".$row_array[0]."</td><td>".$row_array[1]."</td><td>".$row_array[2]."</td>";
echo "</tr>";
}
echo "</table>";
?>
|
If source code run well you may see like below: |
Monday, February 1, 2016
how to read data with php script
Thursday, January 28, 2016
Introduction to PHP Tutorial
PHP Script can consist of code and HTML code. To run PHP you need to install the Apache Server on your computer. Many software software package that provides this need.
I prefer to use xampp software package for simple installation and use easier.
Xampp software you can download from the internet. Below is xampp installer software that I downloaded from the Internet:
Double-click the installer xampp to perform the installation.
After you install Service apache xampp sure aktik by double-clicking XAMPP ControlPanel contained in the desktop.
See the picture below:
See Running Apache service. After service Running Apache Web Server, you can run a PHP script. After install xampp you can write php files in the folder c: \ xampp \ htdocs \
Open notepad and type the code as shown below:
save the file with the name halo.php in the folder c: \ xampp \ htdoc
To see the results you type in your browser http: //localhost/halo.php and press enter
Monday, January 25, 2016
How To Send (Short Message System) sms with visual basic .net?
If YOU want to make your application can send sms below is a visual basic code for sending sms.
Yes this is simple vb code for sending sms.
Often people want to make transactions credit with sms software.
ok just below is its form:
below is complete code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesButton1.Click
COMport.PortName = cboCOMPort.Text
COMport.BaudRate = 19200
COMport.WriteTimeout = 2000
Try COMport.Open()
Catch ex As Exception
MsgBox(ex.Message)
End Try Sleep(300) '....waiting 0.3 seconds tunda = 300
Sleep(tunda)
Below sended SMS to My Hanphone:
Imports System.IO.PortsImports System.Threading.ThreadPublic Class Form1 Private Tunda As Integer
Private WithEvents COMport As New SerialPort Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
For Each COMString As String In My.Computer.Ports.SerialPortNames
cboCOMPort.Items.Add(COMString)
Next cboCOMPort.Sorted = True End Sub
Private WithEvents COMport As New SerialPort Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
For Each COMString As String In My.Computer.Ports.SerialPortNames
cboCOMPort.Items.Add(COMString)
Next cboCOMPort.Sorted = True End Sub
COMport.PortName = cboCOMPort.Text
COMport.BaudRate = 19200
COMport.WriteTimeout = 2000
Try COMport.Open()
Catch ex As Exception
MsgBox(ex.Message)
End Try Sleep(300) '....waiting 0.3 seconds tunda = 300
Sleep(tunda)
Application.DoEvents()
If COMport.IsOpen Then
Try
Dim x As String = "AT+CMGF=1" & Chr(13)
COMport.Write(x)
Sleep(tunda)
Dim y As String = "AT+CMGS=" & Chr(34) & txtNoHP.Text & Chr(34) & Chr(13)
COMport.Write(y)
Sleep(tunda)
Dim z As String = txtPesan.Text & Chr(26)
COMport.Write(z)
Sleep(tunda)
Catch ex As Exception
MsgBox(ex.Message)
End Try
Else
MsgBox("COM port tertutup.")
End If
End SubEnd Class
If COMport.IsOpen Then
Try
Dim x As String = "AT+CMGF=1" & Chr(13)
COMport.Write(x)
Sleep(tunda)
Dim y As String = "AT+CMGS=" & Chr(34) & txtNoHP.Text & Chr(34) & Chr(13)
COMport.Write(y)
Sleep(tunda)
Dim z As String = txtPesan.Text & Chr(26)
COMport.Write(z)
Sleep(tunda)
Catch ex As Exception
MsgBox(ex.Message)
End Try
Else
MsgBox("COM port tertutup.")
End If
End SubEnd Class
Thursday, January 21, 2016
Variable Scoope on Visual Basic .NET
In proramming You will with scoope of variable. Scoope of variable can be local, private or public. Here it is example of scoope variable use in modul and form |
modul code: |
Module Module1 Public sNama As String End Module form Code: Public Class Form1 Private sKota As String Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click sNama = "Visual basic Net" TextBox1.Text = sNama End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click sKota = "Medan" TextBox1.Text = sKota End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim sNegara As String = "Indonesia" TextBox1.Text = sNegara End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click TextBox1.Text = snegara End Sub End Class Di bawah ini adalah gambar demo programnya:
sNegara is stated as error Name “snegara” is not declared.
this is caused by sNegara variable as mentioned with Dim sNegara As String = " |
Thursday, January 14, 2016
Variable Tutorial on Visual Basic .NET
Speak about programming certainly can not be separated from the variable.
What variable is?
A variable is something that can change.
I did not talk long about the types of variables here.
Books or on the internet many references about the various types of variables.
For simplicity I will use string and integer variables only.
eg.
Dim sName as string
sName = "Jhon Doe"
Or
Dim sName As String = "Jhon Doe"
String Variable
string variable is a variable that is used to store characters of letters or words.
Ex: Dim sName as string = "Jhon Doe"
The sName is a string variable
"Jhon Doe" is the content of the string variable.
Procedures for writing and a good naming variables:
Dim sName as string
- The variables that must either be easy to understand:
Ex: Dim iTheGreatestNumber as Integer
i = denotes integer
a combination of uppercase and lowercase facilitate the reading of variables.
Integer Variable
Integer type variables are variables that can store integer.
Ex: dim iNumber as Integer
iNumber = 5
or
Dim iNumber as Integer = 5
Subscribe to:
Posts (Atom)