Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header('Content-type: text/xml');
- // Määrame lehe tüübiks XMLi
- // Andmebaasiga ühendamine
- $host = "localhost";
- $user = "disainee_wp680";
- $pass = "9]Sj)p29MXx";
- $database = "disainee_wp680";
- $con = mysqli_connect($host, $user, $pass, $database);
- if(mysqli_connect_errno()){
- trigger_error('Database connection failed: ' . mysqli_connect_error(), E_USER_ERROR);
- }
- // Määrame, millise charsetiga töötame.
- mysqli_set_charset($con, 'ISO-8859-1');
- $queryID = "SELECT * FROM fb_customers";
- //$queryID = "SELECT * FROM fb_customers WHERE klient = 'Aet Laredei'";
- $resultID = mysqli_query($con, $queryID);
- // Hakkame saadud tellimuse numbri järgi infot väljastama ja XML'i komplekteerima.
- $xml_output = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
- $xml_output .= "<invoices>\n";
- while($row = mysqli_fetch_array($resultID)){
- $xml_output .= "\t";
- $xml_output .= '<invoice customer_name="'.$row['klient'].'">';
- $xml_output .= "\n";
- // Hakkame tellitud toodete ridasid komplekteerima.
- $queryLine = 'SELECT * FROM fb_orders WHERE tellija = "'.$row['klient'].'"';
- $resultLine = mysqli_query($con, $queryLine);
- $i = 0;
- while($rowLine = mysqli_fetch_array($resultLine)){
- $i++;
- $xml_output .= "\t\t";
- $xml_output .= '<line price="'.$rowLine['hind'].'"';
- //$xml_output .= ' product="'.$rowLine['toode'].'"';
- $xml_output .= ' size="'.$rowLine['suurus'].'"';
- $xml_output .= ' color="'.$rowLine['varv'].'" />';
- $xml_output .= "\n";
- }
- $i++;
- $xml_output .= "\t\t";
- $xml_output .= "\n\t</invoice>\n";
- }
- $xml_output .= "</invoices>";
- echo $xml_output;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement