Jump to content

Madmoggie

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Madmoggie's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I've managed to solve it. If anyone has the same problem this is the code i used: //Output the xml string $filenamepath .= "fingerscrossed.xml"; $fp = fopen($filenamepath,'w'); $write = fwrite($fp,$_xml);
  2. Hello I am trying to build a script that gets data from a database and puts it into an XML file. I am getting the data ok but i can't get it to save as a file.... my code is: <?php // set server access variables include ("connection.php"); // create query $query = "SELECT * FROM players"; // execute query $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); // see if any rows were returned if (mysql_num_rows($result) > 0) { // yes //Top of xml file $_xml = '<?xml version="1.0"?>'; $_xml .="<players>"; while($row = mysql_fetch_array($result)) { $_xml .="<player>"; $_xml .="<player_name>".$row['name']."</player_name>"; $_xml .="<player_email>".$row['email']."</player_email>"; $_xml .="<player_team>".$row['team']."</player_team>"; $_xml .="</player>"; } $_xml .="</players>"; //Output the xml string print $_xml; /* Could also write to a file at this point file_put_contents("somedir/some.xml", $_xml); Need to give 'somedir' write permissions */ } else { // no // print status message echo "No rows found!"; } ?> I know at the bottom it says /* Could also write to a file at this point file_put_contents("somedir/some.xml", $_xml); But i don't know what to do with it. i moved it instead of the print function and tried to put - file_put_contents("/IITA/fingerscrossed.xml", $_xml); but no file is produced. do i need to create the file 'fingerscrossed.xml' first or should it happen automatically Thanks for any help you can give
  3. Hey Ok i'd say i'm pretty average with HTML, CSS and PHP I have my own website - www.leedsmethockey.co.uk and i want to develop a new section... i'll try and explain as best i can i have a database with all the players and their email address... When someone is selected for a match i wish the website to email their email address to let them know... please could someone advice me where i need to start and what sort of code i need to be looking into? Many Thanks
  4. hey i have 2 pages, function.inc.php and checkout.php. in functions.inc.php there is a variable called $total. i need this variable to display in the checkout.php page what code do i need to enter to display it??? many thanks <table> <tr> <table border = 2 > <tr><th>Total</th><th>Postage and Packaging</th><th>Grand Total</th></tr> <td>???$total???</td> <td>£5.95</td> <td>(???$total??? + £5.95)</td> </table>
  5. the question is if anyone can build a basket from that table, then could they make it for me?
  6. CREATE TABLE `product` ( `productid` int(100) NOT NULL auto_increment, `type` varchar(40) NOT NULL, `name` varchar(50) NOT NULL, `price` varchar(10) NOT NULL, `description` varchar(60) NOT NULL, `quantity` int(30) NOT NULL, PRIMARY KEY (`productid`) ) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=latin1; -- -- Dumping data for table `product` -- INSERT INTO `product` VALUES (1, 'Jumper', 'Nike Jumper with hood', '23', 'Nike Jumper with Hood, blue ', 43); INSERT INTO `product` VALUES (2, 'Jumper', 'Nike Jumper without hood.', '20', 'Nike Jumper with Hood, light blue ', 28); INSERT INTO `product` VALUES (3, 'Accessories', 'Nike padded gloves', '12', 'strong protective gloves', 10); INSERT INTO `product` VALUES (4, 'Accessories', 'Nike gum guard', '7', 'extra strong and extra good fit', 17); INSERT INTO `product` VALUES (5, 'Shoes', 'Indoor Trainers', '45', 'White indoor trainers, laces', 10); INSERT INTO `product` VALUES (6, 'Shoes', 'Outdoor Astro Trainers', '67', 'black outdoor astro trainers', 12); INSERT INTO `product` VALUES (7, 'Accessories', 'Ball', '3', 'standard white hockey ball', 40); INSERT INTO `product` VALUES (8, 'Accessories', 'Hockey Stick ', '30', 'plain wooden hockey stick', 30);
  7. Thank you sooo much! i spent hours trying to work it out! lol
  8. Hey <?php $productid = $_GET['productid']; $type = $_GET['type']; $name = $_GET['name']; $description = $_GET['description']; $price = $_GET['price']; $quantity = $_GET['quantity']; $query = "SELECT * FROM product"; $result = $db->query($sql); $result = mysql_query ($query) or die ("Error in query: $query. ".mysql_error()); $output[] = '<tr>'; print "<table border = 4 >"; print " <tr><th>Type</th><th>Name</th><th>Description</th><th>Quantity</th><th>Price</th></tr>"; while ($row = mysql_fetch_array($result)) { print "<tr>"; print "<td>" . $row["type"] . "</td>"; print "<td>" . $row["name"] . "</td>"; print "<td>" . $row["description"] . "</td>"; print "<td>" . $row["quantity"] . "</td>"; print "<td>£" . $row["price"]. "</td>"; print "<td>" . $row["!!!!!!!!!!"] "</td>"; print "</tr>"; } print "</table>"; echo join('',$output); ?> Where the !!!!!!! are i need this link - <a href="cart.php?action=add&id='.$row['id'].'">Add to cart</a> But when i put it in all the "" get mixed up - someone please help Manythanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.