Click here to Skip to main content
14,601,122 members
Rate this:
Please Sign up or sign in to vote.
See more:
hi code project member,
i have a code that send data from to PHP. but after get the data from,it will update database mysql. the problem i have is after update in mysql,how to tell the that i had updated my database..

here is my code.

$serialnum = $_GET['ser'];
$company_name = $_GET['comp'];
$date_activate = date("Y-m-d");

$check = mysql_query("SELECT * FROM license WHERE serialnumber = '$serialnum' && status = 'DEACTIVATED'");

	if(mysql_num_rows($check) == 1)
	//if exist in table license,update column status = 'activate' and date_activate = now(), check again in table activate
	//check in table activate
	//if exist,means it already activate
        //if not exist,insert into table activate and
        //the problem is here how to tell that i already update database
	//the problem is here to,how to tell that data is exist 
//the problem is here to,how to tell that query failed

this is my script in

Private Sub activateBtn_Click(sender As Object, e As EventArgs) Handles activateBtn.Click
        Process.Start("http://localhost/license/activate.php?ser=" & serialnum.Text & "&&comp=" & compname.Text)   
    End Sub

i hope codeproject member can help me. thank you.
Updated 16-Oct-19 0:55am
Rate this:
Please Sign up or sign in to vote.

Solution 1


Process.Start is not the right way to call PHP or for that matter any web resource. You need to use System.Net.HttpWebRequest instead. Here is a small snippet to demonstrate how it's done. From your PHP page you can either send tour data in CSV format, or name=value pair on each line format, or JSON format or even XML. The choice is yours.
Dim strReq As String
Dim strData As String
Dim dataStream As Stream 
Dim reader As StreamReader
Dim request As WebRequest
Dim response As WebResponse

strReq = "http://localhost/license/activate.php?ser=" & serialnum.Text & "&&comp=" & compname.Text
request = WebRequest.Create(strReq)
response = request.GetResponse()
dataStream = response.GetResponseStream()
reader = New StreamReader(dataStream)
strData = reader.ReadToEnd()

xana7900 1-Apr-13 2:17am
can u give example how to send data in xml and communicate between vb and xml?
Prasad Khandekar 1-Apr-13 7:01am
It's simple just create a string by conatenation. e.g. $xml = "<root><fname>" . $first_name . "". Then echo this string as response form PHP.
xana7900 1-Apr-13 22:57pm
i have update my question...i want ask how to tell after updated my it possible to tell from php?
Prasad Khandekar 2-Apr-13 10:16am
One simple way is if your PHP processing is successful send a string "SUCCESS" in response or send "FAILED". in you can then take appropriate action. Agiain Process.Start is not a mechanism to be used for this purpose. Look at my solution.
xana7900 2-Apr-13 20:55pm
thanks..u really help me a lot...
Rate this:
Please Sign up or sign in to vote.

Solution 2

hy guys any one knw about how mysql database table nd ms sql databse attach with each other
Richard Deeming 16-Oct-19 15:39pm
Your question is not a "solution" to someone else's question.

If you want to ask a question, then ASK A QUESTION[^]. But you're going to have to provide a lot more information than you have here if you want anyone to be able to help you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100