php mysql and vb.net 2010 help please

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
4 posts Page 1 of 1
Contributors
User avatar
Mark
VIP - Donator
VIP - Donator
Posts: 372
Joined: Mon Aug 17, 2009 10:35 pm

php mysql and vb.net 2010 help please
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;    

?>
You do not have the required permissions to view the files attached to this post.
http://www.mbappz.com
User avatar
Mark
VIP - Donator
VIP - Donator
Posts: 372
Joined: Mon Aug 17, 2009 10:35 pm

Can anyone help me please?
http://www.mbappz.com
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4392
Joined: Tue Aug 04, 2009 1:47 am

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())
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
Mark
VIP - Donator
VIP - Donator
Posts: 372
Joined: Mon Aug 17, 2009 10:35 pm

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())";
You do not have the required permissions to view the files attached to this post.
http://www.mbappz.com
4 posts Page 1 of 1
Return to “Coding Help & Support”