Jump to content

drax

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Everything posted by drax

  1. So you could have an order that looks like orderId=1bb customerID =Joe1 ProductID = 9af quantity = 2 ProductID = 6az quantity = 1 etc? that would all appear in a single instance of the cart?
  2. I wonder if someone could help me with the below I am working through trying to set up a website using a pre built shopping cart(http://www.phpwebcommerce.com.) Have installed fine and set up my categories of products (with images.) However when i try and add a product itself, it will not display the image i assign to it - it just remains blank on both the screen and the mysql database The code for the working image upload is function uploadImage($inputName, $uploadDir) { $image = $_FILES[$inputName]; $imagePath = ''; // if a file is given if (trim($image['tmp_name']) != '') { // get the image extension $ext = substr(strrchr($image['name'], "."), 1); // generate a random new file name to avoid name conflict $imagePath = md5(rand() * time()) . ".$ext"; // check the image width. if it exceed the maximum // width we must resize it $size = getimagesize($image['tmp_name']); if ($size[0] > MAX_CATEGORY_IMAGE_WIDTH) { $imagePath = createThumbnail($image['tmp_name'], $uploadDir . $imagePath, MAX_CATEGORY_IMAGE_WIDTH); } else { // move the image to category image directory // if fail set $imagePath to empty string if (!move_uploaded_file($image['tmp_name'], $uploadDir . $imagePath)) { $imagePath = ''; } } } return $imagePath; } and thew code for the one that does not work is function uploadProductImage($inputName, $uploadDir) { $image = $_FILES[$inputName]; $imagePath = ''; $thumbnailPath = ''; // if a file is given if (trim($image['tmp_name']) != '') { $ext = substr(strrchr($image['name'], "."), 1); //$extensions[$image['type']]; // generate a random new file name to avoid name conflict $imagePath = md5(rand() * time()) . ".$ext"; list($width, $height, $type, $attr) = getimagesize($image['tmp_name']); // make sure the image width does not exceed the // maximum allowed width if (LIMIT_PRODUCT_WIDTH && $width > MAX_PRODUCT_IMAGE_WIDTH) { $result = createThumbnail($image['tmp_name'], $uploadDir . $imagePath, MAX_PRODUCT_IMAGE_WIDTH); $imagePath = $result; } else { $result = move_uploaded_file($image['tmp_name'], $uploadDir . $imagePath); } if ($result) { // create thumbnail $thumbnailPath = md5(rand() * time()) . ".$ext"; $result = createThumbnail($uploadDir . $imagePath, $uploadDir . $thumbnailPath, THUMBNAIL_WIDTH); // create thumbnail failed, delete the image if (!$result) { unlink($uploadDir . $imagePath); $imagePath = $thumbnailPath = ''; } else { $thumbnailPath = $result; } } else { // the product cannot be upload / resized $imagePath = $thumbnailPath = ''; } } return array('image' => $imagePath, 'thumbnail' => $thumbnailPath); } I've tired replacing the product code with the catagorey code. This almost works , as the shows in the db but still does not display in explorer. Sorry if this is unclear but it is driving me insane, as no-one else seems to have had this problem with the tutorial Thanks in advance for any help drax
  3. Hi, thanks very much for replying, I'm a bit of a newbie at this, bit confused about the $user_critera bit where else would that need to be used???? I'm using 3 tables here Main ID, experience (ID & Name) and actual_experience (holds ID of both Main and experience). How would i implement this??? Thanks
  4. Hi, Thanks for all your help. But then how would i be able to select the appropriate names to display back to the user because it would need to search one table to find all the IDs of one (url parameter) and then with all IDs known that would then need to be queried against the original table that has both ID and name. How would you do that?? Thanks
  5. Hi, yes sorry, it is a form and in it is 1 drop down menu and a submit button (onclick the record is INSERTED). The drop down menu displays records that have been searched from a table in my database (ID and Name). in the option it displays the Name to the user but INSERTS the ID. I need it to not only INSERT the ID value from the drop down into the ID field of that table BUT to ALSO INSERT the Name. The Drop Down has both of those details as it displays the name and INSERTS the ID. Heres the code of the INSERT: if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO table (bID, aID, ID, name) VALUES (%s, %s, %s, %s)", GetSQLValueString($_POST['ID'], "int"), GetSQLValueString($_POST['aID'], "int"), GetSQLValueString($_POST['select'], "int"), I wanted to try to add the Name here in the INSERT, I tried linking it to select, text. I also tried linking to a hidden field <? echo $row_list['Name']?> to it.... Heres the code for the drop down: [code]<select name="select"> <?php do { ?> <option value="<?php echo $row_list['ID']?>"><?php echo $row_list['Name']?></option> <?php } while ($row_list = mysql_fetch_assoc($list)); $rows = mysql_num_rows($list); if($rows > 0) { mysql_data_seek($list, 0); $row_list = mysql_fetch_assoc($list); } [/code] Please help me Thanks
  6. Hi there, I was hoping for a little help a with project please. In a form I have a drop down menu that selects records in database and displays them as options to the user. The table that is searches has only 2 fields (ID & name). On the Drop down i have it so the user sees the name of the record and not the ID of it, but at the moment it UPDATES only the ID and not the name. How do i make it so both the ID and Name are UPDATED from using just the drop down??????? If anybody could help that would be ace! Thanks
  7. Thanks for the replies, they were scary fast! Thorpe - I tried your and got "Parse error: syntax error, unexpected '<' on line 32" - prob just highlighting another mistake I made. Revraz - yours seemed to fix it Thank you both so much for your help. Time to crack on and no doubt hit more walls - I'll be back! Cheers
  8. Hi all I'm completely new to php and keep hitting problems that are driving me mad. Could someone be kind enough to look at my code and tell me what stupid mistake I am making? <?php $step=isset($_POST['step'])?$_POST['step']:1; if($step==1) { ?> <FORM METHOD="POST"><H2>Step 1</H2><BR> <INPUT TYPE="HIDDEN" NAME="step" value="2"> <INPUT TYPE="TEXT" Name="username" value="Dave Smith"> <INPUT TYPE="SUBMIT"> </FORM> <? elseif($step==2) { $username=$_POST['username']; ?> <FORM METHOD="POST"><H2>Step 2</H2><BR> <INPUT TYPE="HIDDEN" NAME="step" value="3"> <INPUT TYPE="HIDDEN" NAME="username" value="<?=$username;?>"> <INPUT TYPE="TEXT" Name="email" value="Dave@Smith.com"> <INPUT TYPE="SUBMIT"> </FORM> <? } else { <H2>Step 3</H2><BR> Username: <?=$_POST['username'];?> <BR> Email: <?=$_POST['email'];?><BR> } ?> I get the error "Parse error: syntax error, unexpected T_ELSEIF on line 22" I'm guessing it's a syntax error but have reached the point where I can't see the wood for the trees! any help would be great Cheers
×
×
  • 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.