• hamzabaloch
  • Junior Member
  • Posts 3
  • Reputation 0
  • Member Since
  • Last Active
  • Name Hamza Baloch
  • Gender: Male
  • Location: Dera Ghazi Khan
  • Skype hamzaqaisrani
All Posts Topics Started Likes
PHP Advance = lesson 10
salam 
ap code main php starting aur ending tag ka one standard follow karo <?php ?> ya pher <? ?> 
next thing 
Code:

echo "<table border=1>
<th>stRollno</th>
<th>stClass</th>
<th>stName</th>
<th>Update</th>";

ap uper diya gya table simple html main be to likh saktay thay ap nay kon sa ic main database sa data liya aur put kia 
last baat jo muj ap ka code main nai samaj lagi 
ap table ko start echo sa kar raha ho 
aur end  html per ka tag sa kar rahay ho 
ap nay echo sa table ko end kyu nai kiya ?
0 0
structure Assignment work
salam sir yasir,
sir main ap ke pehli assignment per kam kar raha ho per ic main kuch problem aa rahay  hain please help me main nay bohat search ke per mujha solutions nai mil raha 
meray problem void insertRecord(struct Product pro[]); method main aa raha ha main jab user sa data la lata ho ic ka bad array of structure ko file main store karata to program end ho jata ha please help me sir

#include<iostream>
#include<conio.h>
#include<fstream>
#include<cstring>
#include<string>
#include<cstdlib>
using namespace std;

struct Product
{
int productID;
string productName;
int productQuantaty;
float price;
string inStock;

};

void insertRecord(struct Product pro[]) {
for(int i=0; i<2; i++) {
pro[i].productID = i+1;
cin.ignore();
cout<<"enter the porduct name ";
getline(cin, pro[i].productName);
cout<<"enter the Porduct quantaty";
cin>>pro[i].productQuantaty;
cout<<"enter the price";
cin>>pro[i].price;
cin.ignore();
cout<<"is available product";
getline(cin,pro[i].inStock);
//cout<<pro[i].productName<<pro[i].productID<<pro[i].productQuantaty<<pro[i].price<<pro[i].inStock<<endl;


}

int i = 0;
ofstream ofile;
ofile.open("productdata.txt", ios:[redface]ut,ios::app);
while( i < 2) {

ofile.write((char *) &pro[i], sizeof(Product));
//ofile<<endl;
i++;
}
ofile.close();


}

void editRecord() {

}
void viewRecord(struct Product pro[]) {
//system("CLS");
cout<<"************************available porducts in store******************************"<<endl;
int i=0;
while(i<2) {
cout<<"productId: "<<pro[i].productID<<" Product Name: "<<pro[i].productName<<" Remaining Quantaty: "<<pro[i].productQuantaty<<" Product Price: "<<pro[i].price<<" Instock: "<<pro[i].inStock<<endl;
i++;
}
}

 

bool checkInput(int i,int proId, int proQuantaty, struct Product pro[], struct Product purchaseItems[]) {
cout<<"in checkinput"<<i;
for(int j=i; j<=i; j++) {
for(int k=0; k<2; k++) {
if(proId == pro[k].productID) {
if(proQuantaty <= pro[k].productQuantaty) {
purchaseItems[i].productQuantaty = pro[k].productQuantaty;
purchaseItems[i].productID = pro[k].productID;
purchaseItems[i].productName = pro[k].productName;
pro[k].productQuantaty = pro[k].productQuantaty - proQuantaty;
purchaseItems[i].price = pro[k].price;
return true;
break;
}else {
cout<<j;
cout<<"you enter the quantity above then availeble stock again enter"<<endl;
return false;
break;
}
}
}
cout<<"you enter the worng porduct id "<<endl;
return false;
}
}

void displayOrder(int k, struct Product purchaseItems[]) {
cout<<"*********************your order right now*****************"<<endl;
for (int i = 0; i <= k; i++) {
cout<<"porduct id is :"<<purchaseItems[i].productID<<endl;
cout<<"porduct Names is :"<<purchaseItems[i].productName<<endl;
cout<<"porduct Quantaty is :"<<purchaseItems[i].productQuantaty<<endl;
cout<<"porduct price is :"<<purchaseItems[i].price<<endl;
}
}
void ordercheckOut(struct Product purchaseItems[], int j) {
float toatalPrice = 0;
string customerName;
string customerAddress;
int atmNumber;
cin.ignore();
cout<<"enter your name "<<endl;
getline(cin,customerName);
cin.ignore();
cout<<"enter your address"<<endl;
getline(cin,customerAddress);
cout<<"enter four digit the atm numbre"<<endl;
cin>>atmNumber;
cout<<"enter your six digit ATM Number "<<endl;
cout<<"*************************** your order items *****************************"<<endl;
for(int i=0; i<=j; i++) {
cout<<" Product #"<<i<<endl;
cout<<" porduct Name "<<purchaseItems[i].productName<<" porduct Quantaty "<<purchaseItems[i].productQuantaty<<"porduct Price for single itme "<<purchaseItems[i].price<<" porduct Product Price on "<<purchaseItems[i].productQuantaty<<" items"<<purchaseItems[i].price * purchaseItems[i].productQuantaty<<endl;
}

for(int i=0; i<=j; i++) {
float price = purchaseItems[i].price * purchaseItems[i].productQuantaty;
toatalPrice = toatalPrice + price;
}
cout<<"Total purchasing bill "<<toatalPrice<<endl;
cout<<"thanks for purchasing ";

////creating bill slip
ofstream ofile;
////ofile.open("product/bill/"+customerName+".txt");
ofile.open("bills/"+customerName+".txt", ios:[redface]ut);
string demiName;
int demiQuantaty;
float demiSinglePrice;
float demiNetPrice;
ofile<<"************ your order items *****************"<<endl;
ofile<<"your name :"<<customerName<<endl;
ofile<<"your address :"<<customerAddress<<endl;
ofile<<atmNumber<<endl;
for(int i=0; i<=j; i++) {
ofile<<" Product #"<<i<<endl;
string demiName = purchaseItems[i].productName;
int demiQuantaty = purchaseItems[i].productQuantaty;
float demiSinglePrice = purchaseItems[i].price;
float demiNetPrice = purchaseItems[i].price * purchaseItems[i].productQuantaty;
ofile<<" porduct Name :"<<demiName<<endl<<" porduct Quantaty "<<demiQuantaty<<endl<<"porduct Price for single itme "<<demiSinglePrice<<endl<<" porduct Product Price on "<<demiQuantaty<<" items ="<<demiNetPrice<<endl;
}

for(int i=0; i<=j; i++) {
float price = purchaseItems[i].price * purchaseItems[i].productQuantaty;
toatalPrice = toatalPrice + price;
}
ofile<<"Total purchasing bill :"<<toatalPrice<<endl;
ofile<<"thanks for purchasing ";

ofile.close();


}
void shoping(struct Product pro[],struct Product purchaseItems[]) {
char ch;
cout<<"Press Y or y for shoping "<<endl;
cin>>ch;
int i = 0;
int remaningProduct = 5;
if(ch == 'y' || ch == 'Y') {
char morePurchase;
char checkOutOrder;
int porId;
int proQuantaty;
bool repeat;
cout<<"********According to store policy you can buy 5 different items at one time*********"<<endl;

do {
cout<<"-----------------------------------------------------------------------"<<i<<endl;
if(i>0) {

cout<<"please enter the product id that you want to buy"<<endl;
cin>>porId;
cout<<"enter the quantaty you want to buy"<<endl;
cin>>proQuantaty;
cout<<"Remaning Product you can Purchase :"<<remaningProduct-i<<endl;
repeat = checkInput(i, porId, proQuantaty, pro, purchaseItems);
if(repeat != true) {
i--;
}
displayOrder( i, purchaseItems);
viewRecord( pro );
cout<<"If you want to Conform your order then press O button"<<endl;
cout<<"if want to buy some more thing then press y"<<endl;
cin>>morePurchase;
if(morePurchase == 'o' || morePurchase == 'O') {
ordercheckOut(purchaseItems,i);
}
} else {
cout<<"please enter the product id that you want to buy"<<endl;
cin>>porId;
cout<<"enter the quantaty you want to buy"<<endl;
cin>>proQuantaty;
cout<<"Remaning Product you can Purchase :"<<remaningProduct-i<<endl;
repeat = checkInput(i, porId, proQuantaty, pro, purchaseItems);
if(repeat != true) {
i--;
}
displayOrder( i, purchaseItems);
viewRecord( pro );
cout<<"If you want to Conform your order then press O button"<<endl;
cout<<"If you want to purchase more items then press y button"<<endl;
cin>>morePurchase;
if(morePurchase == 'o' || morePurchase == 'O') {
ordercheckOut(purchaseItems,i);
}
}
//cout<<"before"<<i;
i++;
cout<<"after"<<i;
} while(morePurchase == 'y' || morePurchase == 'Y');
}
/*
cout<<"************************available porducts in store******************************"<<endl;
int i=0;
while(i<2) {
cout<<"productId: "<<pro[i].productID<<" Product Name: "<<pro[i].productName<<" Remaining Quantaty: "<<pro[i].productQuantaty<<" Product Price: "<<pro[i].price<<" Instock: "<<pro[i].inStock<<endl;
i++;
}
*/
}

void main () {
Product pro[2];
Product purchaseItems[2];
char ch;
do {
char choice;
cout<<"*************************** SELECT ********************************"<<endl;
cout<<"******** EDIT ********** press E *"<<endl;
cout<<"******** View *********** press V *"<<endl;
cout<<"******** Insert ********** press i *"<<endl;
cout<<"******** Shoping ********** press s *"<<endl;

cout<<"enter your choice "<<endl;
cin>>choice;
//cin.ignore();
if(choice=='e' || choice=='E') {
editRecord();
} else if (choice=='I' || choice=='i') {
insertRecord(pro);
} else if (choice=='v' || choice=='V') {
viewRecord(pro);
} else if (choice=='s' || choice=='S') {
viewRecord(pro);
shoping(pro,purchaseItems);
}
cout<<"for continue Y ";
cin>>ch;
} while(ch == 'y' || ch == 'Y');

 


/*
int i=0;
while(i<2) {
cout<<pro[i].productName<<pro[i].productID<<pro[i].productQuantaty<<pro[i].price<<pro[i].inStock<<endl;
i++;
}
*/

}

 

0 0
Print layout
Ap ka question to main nay read kia per ek baat mujha samaj nai aa rahi ap A4 size kay page ko web site per print lana cha raha ho to ic ka liya ap ko html ka sath print media ke "css" ko deakhna ho main nay ya kam kiya tha aur ap ka liya kuch classes nikali hain hope so ap ka liya kam aye agr ap php per kam kar raha ho. ek aur kam be ap kar lana A4 ka page to wasay he ap create kar raha ho sath main ic ka image create be kar lana for mailing purpose [smile] 

@page {
size: A4;
margin: 0;
}
@media print {
.page {
margin: 0;
border: initial;
border-radius: initial;
width: initial;
min-height: initial;
box-shadow: initial;
background: initial;
page-break-after: always;
}
}

0 0
count post selected

Add a Website Forum to your website.