Jump to content

mjc302

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

About mjc302

  • Birthday 12/21/1986

Contact Methods

  • Website URL
    http://www.indulgentbeautydesigns.com/about-us.html

Profile Information

  • Gender
    Male

mjc302's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. " . $var . " should be ' . $var . '
  2. Yes I admit I had to look to the rulebook myself
  3. Pikachu2000, no disrespect but that's poor form to not have even looked at the code I posted before critiquing it. If you look back to what I posted on page 1, you'll see that it IS in double quotes. Heres a snippet of what I posted: $message = "Full Name: $_POST[NAME]\n Address: $_POST[ADDRESS]\n Town: $_POST[TOWN]\n Post Code: $_POST[postCODE]\n Phone Number: $_POST[PHONE]\n Email: $_POST[email]\n\n"; $message .= "Page Number: $_POST[PageNumber]\n Product Code: $_POST[ProductCode]\n Product Description: $_POST[Description]\n Price (£): $_POST[Price]\n Quantity: $_POST[Quantity]\n Total: $_POST[Total]\n\n"; Heres a reference from php.net: // The following is okay, as it's inside a string. Constants are not looked for // within strings, so no E_NOTICE occurs here print "Hello $arr[fruit]"; // Hello apple Now, in reply to the original poster, after using what you posted for the form markup, I can tell you that the problem your having is because you have an extra blank <form> element at the beginning. If you remove that from the markup, and then use the processing code exactly how I posted it, your form should work. I have tested this on a live server and received the email fine.
  4. Andy-H, perhaps you should brush up on your PHP fundamentals. See #4 below. Based on the code he posted, without having seen the form markup, there is nothing wrong with what I posted. 1. I removed the literal brackets as they weren't needed. 2. I removed the line references as they didn't appear to have any relevance. 3. I broke the output up by order entries and re-quoted. 4. I removed the array key quotes because constants are not looked for inside strings. See http://php.net/manual/en/language.types.array.php
  5. The code you posted is barely recognizable. Based on what you have, i've cleaned it up enough that it should work. If you're genuinely interested in learning the language, there's many good books that can teach you the basics. I'd recommend Head First PHP from O'Reilly Media. <?php // The message $message = "Full Name: $_POST[NAME]\n Address: $_POST[ADDRESS]\n Town: $_POST[TOWN]\n Post Code: $_POST[postCODE]\n Phone Number: $_POST[PHONE]\n Email: $_POST[email]\n\n"; $message .= "Page Number: $_POST[PageNumber]\n Product Code: $_POST[ProductCode]\n Product Description: $_POST[Description]\n Price (£): $_POST[Price]\n Quantity: $_POST[Quantity]\n Total: $_POST[Total]\n\n"; $message .= "Page Number: $_POST[PageNumber2]\n Product Code: $_POST[ProductCode2]\n Product Description: $_POST[Description2]\n Price (£): $_POST[Price2]\n Quantity: $_POST[Quantity2]\n Total: $_POST[Total2]\n\n"; $message .= "Page Number: $_POST[PageNumber3]\n Product Code: $_POST[ProductCode3]\n Product Description: $_POST[Description3]\n Price (£): $_POST[Price3]\n Quantity: $_POST[Quantity3]\n Total: $_POST[Total3]\n\n"; $message .= "Page Number: $_POST[PageNumber4]\n Product Code: $_POST[ProductCode4]\n Product Description: $_POST[Description4]\n Price (£): $_POST[Price4]\n Quantity: $_POST[Quantity4]\n Total: $_POST[Total4]\n\n"; $message .= "Page Number: $_POST[PageNumber5]\n Product Code: $_POST[ProductCode5]\n Product Description: $_POST[Description5]\n Price (£): $_POST[Price5]\n Quantity: $_POST[Quantity5]\n Total: $_POST[Total5]\n\n"; $message .= "Page Number: $_POST[PageNumber6]\n Product Code: $_POST[ProductCode6]\n Product Description: $_POST[Description6]\n Price (£): $_POST[Price6]\n Quantity: $_POST[Quantity6]\n Total: $_POST[Total6]\n\n"; $message .= "Page Number: $_POST[PageNumber7]\n Product Code: $_POST[ProductCode7]\n Product Description: $_POST[Description7]\n Price (£): $_POST[Price7]\n Quantity: $_POST[Quantity7]\n Total: $_POST[Total7]\n\n"; $message .= "Page Number: $_POST[PageNumber8]\n Product Code: $_POST[ProductCode8]\n Product Description: $_POST[Description8]\n Price (£): $_POST[Price8]\n Quantity: $_POST[Quantity8]\n Total: $_POST[Total8]\n\n"; $message .= "Page Number: $_POST[PageNumber9]\n Product Code: $_POST[ProductCode9]\n Product Description: $_POST[Description9]\n Price (£): $_POST[Price9]\n Quantity: $_POST[Quantity9]\n Total: $_POST[Total9]\n\n"; $message .= "Page Number: $_POST[PageNumber10]\n Product Code: $_POST[ProductCode10]\n Product Description: $_POST[Description10]\n Price (£): $_POST[Price10]\n Quantity: $_POST[Quantity10]\n Total: $_POST[Total10]\n\n"; $message .= "Grand Total: $_POST[GrandTotal]"; // Send $success = "/confirm.html"; if (mail('dimension87@live.co.uk', 'Online Order', $message)) { header('Location: ' . $success); exit(); } ?>
  6. Theres a couple reasons why this doesnt validate. 1. If the Doctype is XHTML, the element and attributes must be lowercase. Also all tags need to be closed, meaning that the param tags need to be self-closed. This is standard xml. 2. Do a search on using the embed tag. The embed tag will never validate however there are many workarounds, some fairly straightforward, some not so much. Try this, it should validate XHTML 1.0 Strict: <object classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" id="MediaPlayer" standby="Loading Windows Media Player components..." width="300" height="300"> <PARAM NAME="url" value="Video.wmv" /> <param name="src" value="Video.wmv" /> <param name="showcontrols" value="true" /> <param name="autostart" value="false" /> <!--[if !IE]>--> <object type="video/x-ms-wmv" data="Video.wmv" width="300" height="300"> <param name="src" value="Video.wmv" /> <param name="autostart" value="false" /> <param name="controller" value="true" /> </object> <!--<![endif]--> </object>
  7. ...something i COMPLETELY overlooked, maybe i need a break THANK YOU! (it worked)
  8. Hi guys, new to the forum. Im in need of some advice. I am setting up a shopping cart using opencart. I have an xml product feed, and am writing a parser script to import/update products. The xml parsing via SimpleXML, image downloads, and category inserts work without a hitch. The product Inserts, not so much. there's 4 tables involved: product, product_description, product_to_category, product_to_store all INSERTs are successful for 3 out of 4 tables. 2,540 products get inserted. However, the product_description table shows only 2,143 rows. For some reason, not all INSERTs to this table produce a valid row. I cleared the tables and run the script many times, and each time produces the same results which leads me to believe the problem has something to do with the data instead of the script, but i have no idea where to start troubleshooting. ive included the applicable code class SpicyDB extends mysqli{ function doesExist ($name, $type) { switch ($type) { case "product": $query = "SELECT product_id from spicyvib_product WHERE model='$name'"; break; case "category": $query = "SELECT category_id from spicyvib_category_description WHERE name='$name'"; break; } $result = $this->query($query); if ($result->num_rows >= 1) $status = $result->fetch_row(); else $status = false; return $status; } function addCategory ($name) { $query = "INSERT INTO spicyvib_category (parent_id) VALUES (0)"; $this->query($query); $last_id = $this->insert_id; $query2 = "INSERT INTO spicyvib_category_description (category_id, name) VALUES ($last_id, '$name')"; $this->query($query2); $query3 = "INSERT INTO spicyvib_category_to_store (category_id, store_id) VALUES ($last_id, 0)"; $this->query($query3); } function getCatIDS () { $catIDS = array(); $result = $this->query("SELECT category_id, name FROM spicyvib_category_description"); while ($row = $result->fetch_assoc()) { $name = $row['name']; $id = $row['category_id']; $catIDS[$name] = $id; } return $catIDS; } function addProduct ($data, $catIDS) { $this->query("INSERT INTO spicyvib_product SET model = '" . $data['model'] . "', quantity = '1', minimum = '1', subtract = '0', stock_status_id = '7', image = '" . $data['image'] . "', date_available = NOW(), manufacturer_id = '0', price = '" . (float)$data['price'] . "', cost = '" . (float)$data['cost'] . "', weight_class_id = '5', length_class_id = '3', status = '1', tax_class_id = '0', date_added = NOW()"); $last_id = $this->insert_id; $this->query("INSERT INTO spicyvib_product_to_store SET product_id = '" . (int)$last_id . "', store_id = '0'"); $this->query("INSERT INTO spicyvib_product_description SET product_id = '" . (int)$last_id . "', language_id = '1', name = '" . $data['name'] . "', description = '" . $data['description'] . "'"); $categoryList = $data['category']; $categoryArr = explode(';', $categoryList); foreach ($categoryArr as $currCategory) { if (!empty($currCategory)) { if (!isset($catIDS[$currCategory])) { $currCategory = 'Miscellaneous'; } $this->query("INSERT INTO spicyvib_product_to_category SET product_id = '" . (int)$last_id . "', category_id = '" . (int)$catIDS[$currCategory] . "'"); } } } } $db = new SpicyDB(DB_HOST, DB_USER, DB_PW, DB_NAME); $categoryXml = new SimpleXMLElement(CAT_FNAME, NULL, TRUE); foreach ($categoryXml->category as $cat) { $name = (string)$cat->name; $exists = $db->doesExist($name, 'category'); if (!$exists) { $db->addCategory($name); } } $category_ids = $db->getCatIDS(); $finalXML = new SimpleXMLElement(OLD_FNAME, NULL, TRUE); foreach ($finalXML->items->item as $item) { $data = array(); $updated = (string)$item->lastupdated; $data['model'] = (string)$item->model; $data['name'] = (string)$item->title; $image_str = (string)$item->image; $image = basename($image_str); $data['image'] = 'data/' . $image; $data['price'] = (float)$item->suggested_retail; $data['cost'] = (float)$item->price; if (empty($data['price'])) { $data['price'] = ($data['cost'] * 2); } $data['description'] = (string)$item->description; $data['category'] = (string)$item->category; switch ($updated) { case "UPDATE": $model = $data['model']; if (!$db->doesExist($model, 'product')) { $db->addProduct($data, $category_ids); } break; } }
×
×
  • 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.