chriltola / projectpoint

0 stars 0 forks source link

3/8/23 #2

Open chriltola opened 1 year ago

chriltola commented 1 year ago

i have a table with following columns [TXDATE] ,[BUSDATE] ,[DORC] ,[TXNUM] ,[TLTXCD] ,[ACCTNO] ,[CUSTID] ,[CCYCD] ,[TX_Currency] ,[AMT] ,[ACC_BRID] ,[ACTYPE] ,[WSNAME] ,[TXDESC] ,[CIFBRID] ,[ATM] ,[PCT_ID] ,[PCT] ,[PPT] ,[PCTTYPE] FROM [test].[dbo].[CASATRN 26-01-2023]

i want to display all of it into the a web page via php code

chriltola commented 1 year ago

// Replace the database credentials with your actual database information $servername = "your_servername"; $username = "your_username"; $password = "your_password"; $dbname = "your_database_name";

// Create a connection $conn = new mysqli($servername, $username, $password, $dbname);

// Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); }

// Query to fetch data from the table $sql = "SELECT * FROM [test].[dbo].[CASATRN 26-01-2023]"; $result = $conn->query($sql);

// Check if there are any rows in the result if ($result->num_rows > 0) { // Output the data in a table on the web page echo "

"; echo ""; while ($row = $result->fetch_assoc()) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo "
TXDATEBUSDATEDORCTXNUMTLTXCDACCTNOCUSTIDCCYCDTX_CurrencyAMTACC_BRIDACTYPEWSNAMETXDESCCIFBRIDATMPCT_IDPCTPPTPCTTYPE
" . $row['TXDATE'] . "" . $row['BUSDATE'] . "" . $row['DORC'] . "" . $row['TXNUM'] . "" . $row['TLTXCD'] . "" . $row['ACCTNO'] . "" . $row['CUSTID'] . "" . $row['CCYCD'] . "" . $row['TX_Currency'] . "" . $row['AMT'] . "" . $row['ACC_BRID'] . "" . $row['ACTYPE'] . "" . $row['WSNAME'] . "" . $row['TXDESC'] . "" . $row['CIFBRID'] . "" . $row['ATM'] . "" . $row['PCT_ID'] . "" . $row['PCT'] . "" . $row['PPT'] . "" . $row['PCTTYPE'] . "
"; } else { echo "No data found."; }

// Close the connection $conn->close(); ?>

chriltola commented 1 year ago

<?php // Replace the database credentials with your actual database information $servername = "your_servername"; $username = "your_username"; $password = "your_password"; $dbname = "your_database_name";

// Create a connection $conn = new mysqli($servername, $username, $password, $dbname);

// Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); }

// Query to fetch data from the table $sql = "SELECT * FROM [test].[dbo].[CASATRN 26-01-2023]"; $result = $conn->query($sql);

// Check if there are any rows in the result if ($result->num_rows > 0) { // Output the data in a table on the web page echo "

"; echo ""; while ($row = $result->fetch_assoc()) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo "
TXDATEBUSDATEDORCTXNUMTLTXCDACCTNOCUSTIDCCYCDTX_CurrencyAMTACC_BRIDACTYPEWSNAMETXDESCCIFBRIDATMPCT_IDPCTPPTPCTTYPE
" . $row['TXDATE'] . "" . $row['BUSDATE'] . "" . $row['DORC'] . "" . $row['TXNUM'] . "" . $row['TLTXCD'] . "" . $row['ACCTNO'] . "" . $row['CUSTID'] . "" . $row['CCYCD'] . "" . $row['TX_Currency'] . "" . $row['AMT'] . "" . $row['ACC_BRID'] . "" . $row['ACTYPE'] . "" . $row['WSNAME'] . "" . $row['TXDESC'] . "" . $row['CIFBRID'] . "" . $row['ATM'] . "" . $row['PCT_ID'] . "" . $row['PCT'] . "" . $row['PPT'] . "" . $row['PCTTYPE'] . "
"; } else { echo "No data found."; }

// Close the connection $conn->close(); ?>

chriltola commented 1 year ago

<?php // Replace the database credentials with your actual database information $servername = "your_servername"; $username = "your_username"; $password = "your_password"; $dbname = "your_database_name";

// Create a connection $conn = new mysqli($servername, $username, $password, $dbname);

// Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); }

// Query to fetch data from the table $sql = "SELECT * FROM [test].[dbo].[CASATRN 26-01-2023]"; $result = $conn->query($sql);

// Check if there are any rows in the result if ($result->num_rows > 0) { // Output the data in a table on the web page echo "

"; echo ""; while ($row = $result->fetch_assoc()) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo "
TXDATEBUSDATEDORCTXNUMTLTXCDACCTNOCUSTIDCCYCDTX_CurrencyAMTACC_BRIDACTYPEWSNAMETXDESCCIFBRIDATMPCT_IDPCTPPTPCTTYPE
" . $row['TXDATE'] . "" . $row['BUSDATE'] . "" . $row['DORC'] . "" . $row['TXNUM'] . "" . $row['TLTXCD'] . "" . $row['ACCTNO'] . "" . $row['CUSTID'] . "" . $row['CCYCD'] . "" . $row['TX_Currency'] . "" . $row['AMT'] . "" . $row['ACC_BRID'] . "" . $row['ACTYPE'] . "" . $row['WSNAME'] . "" . $row['TXDESC'] . "" . $row['CIFBRID'] . "" . $row['ATM'] . "" . $row['PCT_ID'] . "" . $row['PCT'] . "" . $row['PPT'] . "" . $row['PCTTYPE'] . "
"; } else { echo "No data found."; }

// Close the connection $conn->close(); ?>

chriltola commented 1 year ago

< $serverName = "your_servername"; $connectionOptions = array( "Database" => "your_database_name", "Uid" => "your_username", "PWD" => "your_password" );

// Establish the connection $conn = sqlsrv_connect($serverName, $connectionOptions);

if (!$conn) { die("Connection failed: " . print_r(sqlsrv_errors(), true)); }

// Query to fetch data from the table $sql = "SELECT * FROM [test].[dbo].[CASATRN 26-01-2023]"; $result = sqlsrv_query($conn, $sql);

if ($result === false) { die("Query execution failed: " . print_r(sqlsrv_errors(), true)); }

// Check if there are any rows in the result if (sqlsrv_has_rows($result)) { // Output the data in a table on the web page echo "!table"; echo "!tr€thTXDATE€thBUSDATE€thDORC€thTXNUM€thTLTXCD€thACCTNO€thCUSTID€thCCYCD€thTX_Currency€thAMT€thACC_BRID€thACTYPE€thWSNAME€thTXDESC€thCIFBRID€thATM€thPCT_ID€thPCT€thPPT€thPCTTYPE€!tr";

while ($row = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC)) {
    echo "!tr";
    echo "!td" . $row['TXDATE']->format('Y-m-d') . "€td";
    echo "!td" . $row['BUSDATE']->format('Y-m-d') . "€td";
    echo "!td" . $row['DORC'] . "€td";
    echo "!td" . $row['TXNUM'] . "€td";
    echo "!td" . $row['TLTXCD'] . "€td";
    echo "!td" . $row['ACCTNO'] . "€td";
    echo "!td" . $row['CUSTID'] . "€td";
    echo "!td" . $row['CCYCD'] . "€td";
    echo "!td" . $row['TX_Currency'] . "€td";
    echo "!td" . $row['AMT'] . "€td";
    echo "!td" . $row['ACC_BRID'] . "€td";
    echo "!td" . $row['ACTYPE'] . "€td";
    echo "!td" . $row['WSNAME'] . "€td";
    echo "!td" . $row['TXDESC'] . "€td";
    echo "!td" . $row['CIF_BRID'] . "€td";
    echo "!td" . $row['ATM_'] . "€td";
    echo "!td" . $row['PCT_ID'] . "€td";
    echo "!td" . $row['PCT'] . "€td";
    echo "!td" . $row['PPT'] . "€td";
    echo "!td" . $row['PCTTYPE'] . "€td";
    echo "€tr";
}
echo "€table";

} else { echo "No data found."; }

// Close the connection sqlsrv_free_stmt($result); sqlsrv_close($conn); ?>

chriltola commented 1 year ago

i want to create a table as below in sql server

--

CREATE TABLE tblevent ( event_id int(3) NOT NULL, event_name varchar(100) NOT NULL, creator varchar(50) NOT NULL, branch varchar(500) NOT NULL, channel varchar(300) NOT NULL, type varchar(300) NOT NULL, amount double NOT NULL, point_a_transaction int(11) NOT NULL, point_sum_transaction int(11) NOT NULL, startdate date NOT NULL, enddate date NOT NULL, description text NOT NULL, isActive tinyint(4) NOT NULL DEFAULT '0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--

-- ALTER TABLE tblevent ADD PRIMARY KEY (event_id), ADD KEY branch (branch), ADD KEY channel (channel), ADD KEY type (type);

-- ALTER TABLE tblevent MODIFY event_id int(3) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=60;

ALTER TABLE tblevent ADD CONSTRAINT tblevent_ibfk_1 FOREIGN KEY (branch) REFERENCES tblbranch (branch), ADD CONSTRAINT tblevent_ibfk_2 FOREIGN KEY (channel) REFERENCES tblchannel (channel) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT tblevent_ibfk_3 FOREIGN KEY (type) REFERENCES tbltype (type) ON DELETE NO ACTION ON UPDATE NO ACTION;

chriltola commented 1 year ago

CREATE TABLE tblevent ( event_id int NOT NULL IDENTITY(1,1) PRIMARY KEY, event_name varchar(100) NOT NULL, creator varchar(50) NOT NULL, branch varchar(500) NOT NULL, channel varchar(300) NOT NULL, type varchar(300) NOT NULL, amount float NOT NULL, point_a_transaction int NOT NULL, point_sum_transaction int NOT NULL, startdate date NOT NULL, enddate date NOT NULL, description text NOT NULL, isActive tinyint NOT NULL DEFAULT 0 );

-- Add the foreign key constraints ALTER TABLE tblevent ADD CONSTRAINT FK_tblevent_tblbranch FOREIGN KEY (branch) REFERENCES tblbranch (branch), ADD CONSTRAINT FK_tblevent_tblchannel FOREIGN KEY (channel) REFERENCES tblchannel (channel), ADD CONSTRAINT FK_tblevent_tbltype FOREIGN KEY (type) REFERENCES tbltype (type);

chriltola commented 1 year ago

i have a tblevent. i want to list it it from sqlserver to the web page via php

No. Event Name Description Creator Start Date End Date Status Action
chriltola commented 1 year ago

Dear Support Team,

Regardly advice solution the message error as following

I have compare data in this month to previous month and the result, all data are the same format but it still cannot upload.

please find the attachment for the data comparation.

Regards,

Tola Chril

chriltola commented 1 year ago

Subject: Issue with Data Upload

Dear Support Team,

I hope this email finds you well. I am writing to seek your assistance in resolving an error I encountered while trying to upload data.

I have compared the data from this month with the data from the previous month, and both sets are in the same format. However, I am still unable to upload the data successfully.

I have attached the data comparison for your reference. Could you please review it and advise on a solution to rectify the issue?

Thank you for your prompt attention to this matter.

Best regards,

Tola Chril

chriltola commented 1 year ago

Subject: Re: Issue with Data Upload

Dear Support Team,

I would like to express my gratitude for your prompt response and helpful advice on resolving the data upload issue. Your guidance has been instrumental in addressing the first problem.

Now, I would like to bring your attention to a second issue I encountered. While attempting to generate a report based on the uploaded data, I noticed discrepancies in the output. The report seems to be missing some crucial information, which was present in the original data set.

Could you kindly investigate this matter further and provide any insights or suggestions on how to rectify this report generation problem?

Once again, thank you for your ongoing support and assistance. I appreciate your expertise in helping me overcome these challenges.

Best regards,

Tola Chril

chriltola commented 1 year ago

Subject: Request for Mail Verification

Dear Mr. [Recipient's Last Name],

I hope this email finds you well. We are writing to kindly request your attention to an email that was sent to you on [Date]. The purpose of this message was to address [briefly mention the main topic or reason for the email].

We would be immensely grateful if you could take a moment to verify the receipt of the aforementioned email. As it contains critical information, we want to ensure that it reached you successfully and without any issues.

If you have already reviewed the email and taken the necessary actions, please accept our gratitude for your prompt response.

In the event that you have not yet received the email, or if it might have inadvertently landed in your spam or junk folder, we kindly request you to check those folders as well.

Your prompt attention to this matter will be greatly appreciated. If you encounter any concerns or require any further information, please do not hesitate to contact us.

Thank you for your time and consideration.

Best regards,

[Your Name] [Your Title/Position] [Your Company/Organization Name] [Your Contact Information]

chriltola commented 1 year ago

i have the following batch script

REM Get total memory set totalMem= for /f "tokens=4" %%a in ('systeminfo ^| findstr Physical') do ( if defined totalMem ( set availableMem=%%a ) else ( set totalMem=%%a ) )

set totalMem=%totalMem:,=% set availableMem=%availableMem:,=% set /a usedMem=totalMem-availableMem

REM Get CPU load percentage setlocal enabledelayedexpansion set Times=0

for /f "skip=1" %%p in ('wmic cpu get loadpercentage') do ( set Cpusage!Times!=%%p set /A Times=!Times! + 1 )

REM Get HDD free space for /f "skip=1 delims=" %%h in ('wmic logicaldisk get DeviceID^,FreeSpace^|findstr /r /v "^$"') do ( for /f "tokens=2" %%i in ("%%h") do ( set "hdd_free_space=%%i" goto :break_hdd_free_space ) ) :break_hdd_free_space

REM Get hostname for /f "skip=1 delims=" %%A in ( 'wmic computersystem get name' ) do for /f "delims=" %%B in ("%%A") do set "compName=%%A"

REM Output the results to a text file ( echo Hostname: %compName% echo Total Memory: %totalMem% echo Used Memory: %usedMem% echo CPU Load Percentage: %Cpusage0% echo HDD Free Space: %hdd_free_space% ) > C:\0001\system_info.txt

echo Results exported to system_info.txt.

the result of it return with following format

Hostname: HOE-ITDAPPSPT04
Total Memory: 8027 Used Memory: 6203 CPU Load Percentage: 1 HDD Free Space: 38933372928

i want to make the viewo look good and want to change the value of HHD Free Space, memory used and total memory used to GB

chriltola commented 1 year ago

@echo off REM Get total memory set totalMem= for /f "tokens=4" %%a in ('systeminfo ^| findstr Physical') do ( if defined totalMem ( set availableMem=%%a ) else ( set totalMem=%%a ) )

set totalMem=%totalMem:,=% set availableMem=%availableMem:,=% set /a usedMem=totalMem-availableMem

REM Convert memory values to GB set /a totalMemGB=totalMem/1024 set /a usedMemGB=usedMem/1024

REM Get CPU load percentage for /f "skip=1" %%p in ('wmic cpu get loadpercentage') do ( set "Cpusage=%%p" goto :break_cpu_load ) :break_cpu_load

REM Get HDD free space for /f "skip=1 delims=" %%h in ('wmic logicaldisk get DeviceID^,FreeSpace^|findstr /r /v "^$"') do ( for /f "tokens=2" %%i in ("%%h") do ( set /a hdd_free_space=%%i/1024/1024/1024 goto :break_hdd_free_space ) ) :break_hdd_free_space

REM Get hostname for /f "skip=1 delims=" %%A in ( 'wmic computersystem get name' ) do for /f "delims=" %%B in ("%%A") do set "compName=%%A"

REM Output the results to a text file ( echo Hostname: %compName% echo Total Memory: %totalMemGB% GB echo Used Memory: %usedMemGB% GB echo CPU Load Percentage: %Cpusage% echo HDD Free Space: %hdd_free_space% GB ) > C:\0001\system_info.txt

echo Results exported to system_info.txt. pause

chriltola commented 1 year ago

@echo off REM Get total memory set totalMem= for /f "tokens=4" %%a in ('systeminfo ^| findstr Physical') do ( if defined totalMem ( set availableMem=%%a ) else ( set totalMem=%%a ) )

set totalMem=%totalMem:,=% set availableMem=%availableMem:,=% set /a usedMem=totalMem-availableMem

REM Get CPU load percentage setlocal enabledelayedexpansion set Times=0

for /f "skip=1" %%p in ('wmic cpu get loadpercentage') do ( set Cpusage!Times!=%%p set /A Times=!Times! + 1 )

REM Get HDD free space for /f "skip=1 delims=" %%h in ('wmic logicaldisk get DeviceID^,FreeSpace^|findstr /r /v "^$"') do ( for /f "tokens=2" %%i in ("%%h") do ( set /a hdd_free_space_gb=%%i/1024/1024/1024 goto :break_hdd_free_space ) ) :break_hdd_free_space

REM Get hostname for /f "skip=1 delims=" %%A in ( 'wmic computersystem get name' ) do for /f "delims=" %%B in ("%%A") do set "compName=%%A"

REM Output the results to a text file ( echo Hostname: %compName% echo Total Memory: %totalMem% echo Used Memory: %usedMem% echo CPU Load Percentage: %Cpusage0% echo HDD Free Space: %hdd_free_space_gb% GB ) > C:\0001\system_info.txt

echo Results exported to system_info.txt.