Jump to content

Dubya008

Members
  • Posts

    23
  • Joined

  • Last visited

    Never

Everything posted by Dubya008

  1. okay So i made the changes that you suggested. It is now deleting 2 of the elements at once. Would I need to rebuild the entire array after I've deleted the element of the array? $Item1=array("ProdID"=>"Hat","Color"=>"Not Needed","Size"=>5); $Item4=array("ProdID"=>"Shirt","Color"=>"Green","Size"=>"L"); $Item2=array("ProdID"=>"Pants","Color"=>"Not Needed","Size"=>"32x32"); $Item3=array("ProdID"=>"Socks","Color"=>"Not Needed","Size"=>"Not Needed"); $NumItems=4; $_SESSION['Cart']=array(1=>$Item1,2=>$Item2,3=>$Item3,4=>$Item4,"NumItems"=>$NumItems); $ItemNum=$_GET['id']; if ($ItemNum=="All"){ //deleting everything in the cart unset($_SESSION['Cart']); } else{ $_SESSION['Cart']['NumItems']--; //taking the number of items down by 1 if(!$_SESSION['Cart']['NumItems']) //checking to see if the number of items is above zero { unset($_SESSION['Cart']); //if the number is above zero then delete the whole variable } else //deleting a specific element of the array { echo "DELETING ".$_GET['id']."<br>"; unset($_SESSION['Cart'][$ItemNum]); }
  2. I am using session variables to keep track of what is in a shopping cart. I can add the items to the cart quite easily enough. But my problem is that I can't delete a specific item in the cart. Below is a summary of what the array looks like $Item1=array("ProdID"=>"Hat","Color"=>"Not Needed","Size"=>5); $Item4=array("ProdID"=>"Shirt","Color"=>"Green","Size"=>"L"); $Item2=array("ProdID"=>"Pants","Color"=>"Not Needed","Size"=>"32x32"); $Item3=array("ProdID"=>"Socks","Color"=>"Not Needed","Size"=>"Not Needed"); $NumItems=4; $TestArray=array("NumItems"=>$NumItems,1=>$Item1,2=>$Item2,3=>$Item3,4=>$Item4); However when I attempt to delete any of the top level elements (1,2,3,4,NumItems), I either end up deleting only the last element (4) or somehow taking out 2 of them. I know that this must be an easy fix but I've looked at it for so long that I can't seem to figure out what the problem is. below is the code that I use to delete the Item from the array $ItemNum=$_GET['item']; if ($ItemNum=="All"){ $ItemNum=$_GET['item']; if ($ItemNum=="All"){ unset($TestArray); unset($TestArray['NumItems']); unset($_SESSION['OrderTotal']); //header("Location:Cart.php?act=view"); } else{ $TestArray['NumItems']=$TestArray['NumItems']-1; if($TestArray['NumItems']<1) { unset($_SESSION['OrderTotal']); unset($TestArray); unset($TestArray['NumItems']); } else { unset($TestArray[$ItemNum]); } Can anyone take a look at this and point me in the correct direction? What I am after is to delete any element of the top array and keep the rest.
  3. yes exactly the same attributes nothing more nothing less. So that I can create a dynamic query that will give me the products that have attribute 25 and 45. Or any other attributes that I need to add
  4. I'm thinking that this may be impossible from the same table. Would anyone with more experience point me in the right direction to even see if this is possible?
  5. Those were all very helpful however none of them returned what I'm looking for. Given the example above here is what I want returned. products 234 & 568 because they have both attributes 23 and 45
  6. I have a table that has numeric values in it id, Product, Attribute It is a "cross-over" table that stores attribute values for products. There can be more than 1 attribute per product: id Product Attribute 1 234 45 2 234 23 3 896 45 4 896 33 5 568 23 6 568 45 7 790 23 I need to create a Query that will return all of the products that have the same attributes. I've tried the following which returns nothing SELECT * FROM ProdAts WHERE Attribute='45' AND Attribute ='23' This returns nothing. I believe that I understand why(No row contains both numbers) If i use an OR instead of an AND i get some Products that have only 1 of the attributes. I'm attempting to pull all products that have the same attributes. Is this possible via SQL?
  7. I'm looking for a method that will return the date for the next 2 weeks in php. I can pull the date but I'm not sure about adding to the date. Can anyone point me in the correct direction?
  8. Thank you for your response. I believe that is exactly what we're doing: using the end-user's address to send the info to our specific address. I've pasted some code that we had from the website designer. Can you tell me if you think that is the reason why it wouldn't work. define('kOptional', true);define('kMandatory', false);error_reporting(E_ERROR | E_WARNING | E_PARSE);ini_set('track_errors', true);function DoStripSlashes($fieldValue) { if ( get_magic_quotes_gpc() ) { if (is_array($fieldValue) ) { return array_map('DoStripSlashes', $fieldValue); } else { return stripslashes($fieldValue); } } else { return $fieldValue; } }function FilterCChars($theString) {return preg_replace('/[\x00-\x1F]/', '', $theString);}function CheckEmail($email, $optional) {if ( (strlen($email) == 0) && ($optional === kOptional) ) { return true;} elseif ( eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email) ) { return true;} else { return false;}}if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {$clientIP = $_SERVER['HTTP_X_FORWARDED_FOR'];} else {$clientIP = $_SERVER['REMOTE_ADDR'];}$FTGFname = DoStripSlashes( $_POST['Fname'] );$FTGLname = DoStripSlashes( $_POST['Lname'] );$FTGCompany = DoStripSlashes( $_POST['Company'] );$FTGEmail = DoStripSlashes( $_POST['Email'] );$FTGWebsite = DoStripSlashes( $_POST['Website'] );$FTGPhone = DoStripSlashes( $_POST['Phone'] );$FTGCity = DoStripSlashes( $_POST['City'] );$FTGState = DoStripSlashes( $_POST['State'] );$FTGPostal = DoStripSlashes( $_POST['Postal'] );$FTGCountry = DoStripSlashes( $_POST['Country'] );$FTGQes1 = DoStripSlashes( $_POST['Qes1'] );$FTGQes2 = DoStripSlashes( $_POST['Qes2'] );$FTGQes3 = DoStripSlashes( $_POST['Qes3'] );$FTGPage=DoStripSlashes( $_POST['page'] );$validationFailed = false;# Fields Validationsif (!CheckEmail($FTGEmail, kMandatory)) { $validationFailed = true; }# Redirect user to the error pageif ($validationFailed === true) {#header("Location: http://lynxfulfillment.com/index.html");echo "<script>location='{$_SERVER['HTTP_REFERER']}'</script>"; }if ( $validationFailed === false ) {# Email to Form Owner $emailSubject = FilterCChars("Lynx Fulfillment Website"); $emailBody = "Fname : $FTGFname\n" . "Lname : $FTGLname\n" . "\n" . "Company : $FTGCompany\n" . "Email : $FTGEmail\n" . "Website : $FTGWebsite\n" . "Phone : $FTGPhone\n" . "City : $FTGCity\n" . "State : $FTGState\n" . "Postal : $FTGPostal\n" . "Country : $FTGCountry\n" . "\n" . "Qes1 : \n" . "$FTGQes1\n" . "\n" . "Qes2 : \n" . "$FTGQes2\n" . "\n" . "Qes3 : \n" . "$FTGQes3\n" . "Site Number : 1\n" . "Page Used : $FTGPage\n" . "IP: $clientip \n" . "index.html"; $emailTo = 'Lynx <prandolph@lynxfulfillment.com>'; $emailFrom = FilterCChars("$FTGEmail"); $emailHeader = "From: $emailFrom\n" . "MIME-Version: 1.0\n" . "Content-type: text/plain; charset=\"ISO-8859-1\"\n" . "Content-transfer-encoding: 7bit\n"; mail($emailTo, $emailSubject, $emailBody, $emailHeader); # Redirect user to success pageheader("Location: http://www.lynxfulfillment.com/success.html");}?>
  9. I'm using the php mail function on some forms for our company website. There is reason to believe that they sometimes don't work. Is this a normal behavior for this? We've been "discussing" whether or not they work for about 2 - 3 days and in most instances they do. However we've had 1 person fill them out and then we never received the emails. I was wondering if some of the people that have worked with php for a longtime have ever had any experience with this type of thing happening.
  10. Wow that worked like a charm. Thanks so much for the help guys. My final Query is below. I didn't need the Product Name as that will be already displayed on the screen in other places. SELECT Attributes.Attribute, Products_Attributes.Product FROM Attributes LEFT JOIN Products_Attributes ON Products_Attributes.Attribute = Attributes.id AND Products_Attributes.Product = '1'
  11. KickStart that was helpful and can be used in another spot for something else so Thank you for that. However that wasn't quite what I was looking for. I need to have the following Attribute Product Men's 1 Women's Color 1 Size 1 Fun!! Boring Awesome I don't know if that makes sense to anyone but me. I just want all of the Attriubutes on the left and on the right the specific product that we're looking at.
  12. I have 2 tables Attributes id,Attribute 1,Men's 2,Women's 3,Color 4,Size 5,Fun!! 6,Boring 7,Awesome Products_Attributes id,Product,Attribute 1, 1, 1 2, 1, 4 3, 2, 1 4, 2, 5 5, 1, 3 6, 2, 6 7, 2, 7 I'm trying to pull all of the data from the Attributes table next to all of the data product data for a particular product. I've tried using left joins but am having a tough time with it. So far this is what I have but it is only pull the attributes for the product. SELECT Attributes.Attribute, Products_Attributes.Product FROM Attributes LEFT JOIN Products_Attributes ON Attributes.id=Products_Attributes.Attribute WHERE Products_Attributes.Product ='1' What I am getting is: Attribute,Product Men's, 1 Size, 1 Color, 1 Anyone know how to pull all the Attributes and only one product?
  13. I don't know if this is the correct Forum to post this under but I'm trying to fill the values of a recordset into an array. Here is what I have but it doens't work so far. function fetch($info) { return mysql_fetch_array($info); } $Proddb = new mysql; $Proddb->connect(); $result = $Proddb->query("SELECT * FROM Colors WHERE id = '1'"); $row = $Proddb->fetch($result) foreach ($row as $value) { echo $value. "<br>"; } $Proddb-> close(); The array is outputting everything twice does anyone know why?
  14. HA! I was almost there. That worked perfectly thanks so much everyone for the help.
  15. Okay that makes sense... I tried this $db = new mysql; $db->connect(); $row = $db->fetch($db->query("SELECT * FROM Attributes")); while($row) { echo $row['Attribute']."<br>"; } and got the same thing. is there a do until statement in PHP?
  16. I'm starting to use a class to perform DB functions because I think it is more efficient. I found this class on the internet and understand pretty well what is going on. My problem is that I can't put the results on the screen when I use the class. (I can do it with out using the class but I'd like to learn to use it) function fetch($info) { return mysql_fetch_array($info); this is how I'm attempting to use it $db = new mysql; $db->connect(); while($row = $db->fetch($db->query("SELECT * FROM Attributes"))) { echo $row['Attribute']."<br>"; } This just echos the first row forever and I'm not sure how else to go about this. Any help would be appreciated.
  17. I've found the following PHP code from the ShopSite forum. I was told that it could be changed to post all of the data it is getting to a new URL. I'm not a PHP master so i'm having trouble following it. Can I get some help on where I'd post all of the data to a new URL?? <?PHP // Note: $_POST variable not available since this script is called as a // CGI script, so we have to read in our params from stdin, with length // determined by the CONTENT_LENGTH environment variable. // Read in POST parameters sent by ShopSite $stdin = fopen("php://stdin","r"); fscanf($stdin,"%{$SERVER['CONTENT_LENGTH']}s",$query_string); // And now we split the params into the $params array. parse_str($query_string,$params); if ( $params['cust_country'] && $params['item_total'] ) { // You would normally include code here for determining // your shipping rates and options. Remember that all input // parameters are in the $params array. // // The variables to set for the output (assuming you use the // output code included in this example) are $status, $options, // and $prices. $options and $prices are arrays. } else { $status="fail"; $error=urlencode("Params are ".var_export($params,true)); $option_count=0; } // Output data to ShopSite echo "status=".$status."\n"; echo "option_count=".$option_count."\n"; if ($status="fail") { echo "error=".$error."\n"; } for ( $option = 1; $option <= $option_count; $option += 1 ) { echo "s".$option."option=".$options["$option"]."\n"; echo "s".$option."price=".$prices["$option"]."\n"; } ?>
  18. SO i've been able to make some progress (if that is what you'd call it). The GetOrderInfo Method needs 3 parameters: Username Password OrderId I've got the following code $Username='UserTest'; $Password='test'; $orderId='ZoneTest'; $client = new SoapClient("http://lynxmin.lynxfulfillment.com/pmomsws/order.asmx?wsdl"); $client->GetOrderInfo($Username,$Password,$orderID); I'm not sure why but the parameters aren't passing over correctly. Is there something i should be doing differently?
  19. I've been able to find some info on returning a list of functions. (below) Now my problem is that i need to post a request and am having trouble doing that one. $wsdl_url ="http://lynxmin.lynxfulfillment.com/pmomsws/order.asmx?wsdl"; $client = new SoapClient($wsdl_url); var_dump($client->__getFunctions());
  20. I've built a few website using PHP and MySQL. What I'm looking to do now is to use PHP to execute SOAP commands. I have a list of operations found at http://lynxmin.lynxfulfillment.com/pmomsws/order.asmx I'm trying to pull order info and add an order via PHP. I'm not sure where to start can anyone point me in the correct direction or provide an example of how to execute one of the comands?
×
×
  • 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.