Click here to Skip to main content
11,925,851 members (61,965 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB PHP VB.NET
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.
Posted 31-Mar-13 19:37pm
Edited 1-Apr-13 17:55pm

1 solution

Rate this: bad
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()
xanesa 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 = "" . $first_name . "". Then echo this string as response form PHP.
xanesa 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.
xanesa 2-Apr-13 20:55pm
thanks..u really help me a lot...

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web03 | 2.8.151126.1 | Last Updated 1 Apr 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

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