Page 1 of 1

php mysql and vb.net 2010 help please

Posted: Fri Apr 01, 2016 12:51 pm
by Mark
Hello,

i'm trying to display my records that have the current date that matches the paydate to show in the listview with there name , number, money and the totals it all up at the label1

this is the vb.net code
Code: Select all
Imports System.IO

Public Class frmMain

    Dim amount, amount1, amount2 As Double

    Public Sub Search()

        Try
            amount = 0
            amount1 = 0
            amount2 = 0

            ListView1.Items.Clear()
            PostData.Clear()
            PostData.Add("mode", "SearchDate")
            PostData.Add("date", TextBox1.Text)
            PostData.Add("name", Name)
            PostData.Add("Admin", Admin)
            Dim responseStream0 As Stream = PostToSite(SiteURL & "due.php", PostData).GetResponseStream
            Using reader2 As StreamReader = New StreamReader(responseStream0)
                Do While Not reader2.EndOfStream

                    Dim profileData As String() = reader2.ReadLine.Trim.Split("!")
                    Dim contact0 As String = profileData(0)
                    Dim item As New ListViewItem

                      Select contact0
                        Case "NotFound"
                            MsgBox("No orders need to be paid today.", MsgBoxStyle.Information, "No Payment")
                        Case Else


                            If profileData(3) = "late" Then
                                item.SubItems.Add(profileData(0))
                                item.SubItems.Add(profileData(1))
                                amount = cDal.VarToDbl(profileData(2))

                                amount2 = Format(amount, "c")
                                item.SubItems.Add("£" & amount2 & ".00")
                                Me.ListView1.Items.Add(item)
                                amount1 += amount
                                Label1.Text = "£" & amount1 & ".00"
                            Else
                                'MsgBox("No orders need to be paid today.", MsgBoxStyle.Information, "No Payment")
                                Exit Sub
                            End If
                    End Select
                Loop

            End Using
        Catch ex As Exception

        End Try

    End Sub

    Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown

        If e.KeyCode = Keys.Enter Then
            Search()
        Else
        End If

    End Sub

    
    Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        TextBox1.Text = Date.Today.ToString("dd/MM/yyyy")
        Timer1.Enabled = True


    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Timer1.Enabled = False
        Search()
    End Sub
End Class
This is the php code
Code: Select all
<?php

include 'config.php';

$id = htmlspecialchars($_POST["Uid"], ENT_QUOTES);
$id = mysql_real_escape_string($_POST['Uid']);
$paydate = htmlspecialchars($_POST["$paydate"], ENT_QUOTES); 
$paydate = mysql_real_escape_string($_POST['paydate']);
$name = htmlspecialchars($_POST["name"], ENT_QUOTES); 
$name = mysql_real_escape_string($_POST['name']);
$number = htmlspecialchars($_POST["number"], ENT_QUOTES); 
$number = mysql_real_escape_string($_POST['number']);
$money = htmlspecialchars($_POST["money"], ENT_QUOTES); 
$money = mysql_real_escape_string($_POST['money']);


$SecretPassword = htmlspecialchars($_POST["Admin"], ENT_QUOTES); 
if($SecretPassword == $Admin)

switch (mysql_real_escape_string($_POST["mode"]))
	{
	    case 'SearchDate':
	        $sql2 = "SELECT customers.name, customers,number, customers.money FROM customers INNER JOIN customers ON customers.name= customers.name WHERE customers.paydate ='$paydate'";
	        
	    
                $result2 = mysql_query($sql2); 

			if(mysql_num_rows($result2) > 0)
                        while ($row = mysql_fetch_array($result2))
{  
			echo $row['name']."!";
			echo $row['number']."!";
			echo $row['money']."\r\n";
}
		break;
	}


mysql_close();

exit;    

?>

Re: php mysql and vb.net 2010 help please

Posted: Sun Apr 03, 2016 9:46 am
by Mark
Can anyone help me please?

Re: php mysql and vb.net 2010 help please

Posted: Sun Apr 03, 2016 11:22 am
by CodenStuff
It would be something in your query would it not?

Get the records where paydate is same date as today doing something like:
Code: Select all
.... WHERE DATE(paydate) = DATE(NOW())

Re: php mysql and vb.net 2010 help please

Posted: Mon Apr 04, 2016 2:48 pm
by Mark
Hello,

I tried what you said but still nothing shows up the tables called customers i have attached a screenshot of the table?
Code: Select all
 $sql2 = "SELECT customers.name, customers,number, customers.money FROM customers INNER JOIN customers ON customers.name= customers.name WHERE DATE(paydate) = DATE(NOW())";