Jump to content

warrenk

Members
  • Posts

    22
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

warrenk's Achievements

Member

Member (2/5)

0

Reputation

  1. Can I use a CASE statement in a SET? Or is this not possible? update ix_spc_product set Desc6 = CHAR(@FISCAL_MONTH), Value1 = @T_UNITS_SOLD_LM, Value2 = @T_DOLLARS_SOLD_LM, Value3 = (@T_DOLLARS_SOLD_LM - @T_COST_LM), Case @T_DOLLARS_SOLD_LM WHEN 0 Value4 = 0 ELSE Value4 = (@T_DOLLARS_SOLD_LM - @T_COST_LM) / @T_DOLLARS_SOLD_LM END Value5 = @T_UNITS_SOLD_6M, Value6 = @T_DOLLARS_SOLD_6M, Value7 = (@T_DOLLARS_SOLD_6M - @T_COST_6M), Value8 = (@T_DOLLARS_SOLD_6M - @T_COST_6M) / @T_DOLLARS_SOLD_6M, Value9 = @T_UNITS_SOLD_12M, Value10 = @T_DOLLARS_SOLD_12M, Value11 = (@T_DOLLARS_SOLD_12M - @T_COST_12M), Value12 = (@T_DOLLARS_SOLD_12M - @T_COST_12M) / @T_DOLLARS_SOLD_12M, Value13 = @T_UNITS_SOLD_LY, Value14 = @T_DOLLARS_SOLD_LY where ID = @ITEM_NUMBER
  2. I have a SQL that has divide by zero errors. Is there anyway to prevent this? update ix_spc_product set Desc6 = CHAR(@FISCAL_MONTH), Value1 = @T_UNITS_SOLD_LM, Value2 = @T_DOLLARS_SOLD_LM, Value3 = (@T_DOLLARS_SOLD_LM - @T_COST_LM), Value4 = (@T_DOLLARS_SOLD_LM - @T_COST_LM) / @T_DOLLARS_SOLD_LM, Value5 = @T_UNITS_SOLD_6M, Value6 = @T_DOLLARS_SOLD_6M, Value7 = (@T_DOLLARS_SOLD_6M - @T_COST_6M), Value8 = (@T_DOLLARS_SOLD_6M - @T_COST_6M) / @T_DOLLARS_SOLD_6M, Value9 = @T_UNITS_SOLD_12M, Value10 = @T_DOLLARS_SOLD_12M, Value11 = (@T_DOLLARS_SOLD_12M - @T_COST_12M), Value12 = (@T_DOLLARS_SOLD_12M - @T_COST_12M) / @T_DOLLARS_SOLD_12M, Value13 = @T_UNITS_SOLD_LY, Value14 = @T_DOLLARS_SOLD_LY where ID = @ITEM_NUMBER
  3. I have a PHP page that runs a SQL after the submit button is pressed. The SQL is a insert. When I run the SQL from PHPMYADMIN, the SQL works fine. When I submit the SQL from the PHP page, it looks like the SQL times out. The SQL does take a little while to run. Is there anyway to change my page so it doesn't time out? Thanks! Warren
  4. http://www.website.com/product-xx11-p-16191.html http://www.website.com/product-xx22-p-16192.html (etc) I am trying to strip out the number ie. 16191, 16192, etc) into a field. The number is always just before the '.html' and right after '-p-'. Any suggestions? If it requires more then one SQL...not a problem. Appreciate any help! Warren
  5. I have two tables in a one (master) to many (detail) relationship. Is there anyway to select this as a one-to-one relationship? I would use DISTINCT, but one of the fields I select in the detail file is not unique. So even with the DISTINCT, it always selects multiple detail records for each master. I just want one occurance of the detail record. Thanks, Warren
  6. I know there is a way to limit the size of a uploaded file. Is there a way to put a size limit on the folder where the file is been uploaded? if($_POST['Upload']) { $target_path = "/nornet/portal/vendor_images/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); $_FILES['uploadedfile']['tmp_name']; $target_path = "/nornet/portal/vendor_images/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "<b>The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded</b><br><br>"; } else{ echo "</b>There was an error uploading" . basename( $_FILES['uploadedfile']['name']). "the file, please try again!</b><br><br>"; } } echo("<form enctype='multipart/form-data' action='' method='POST'>"); echo("Upload File: <input name='uploadedfile' type='file'><br>"); echo("<input type='submit' name='Upload' value='Upload'>"); echo("</form>");
  7. warrenk

    Button

    Thanks Balmung...the $_Post['Upload'] works! Appreciate your help! Warren
  8. warrenk

    Button

    I am trying to determine if the Upload button is pressed. When it is pressed, I tried to display a message. The message never displays. How can I determine if the Upload button is pressed? echo("<form enctype='multipart/form-data' action='' method='POST'>"); echo("<input type='hidden' name='MAX_FILE_SIZE' value='100000' />"); echo("Choose a file to upload: <input name='uploadedfile' type='file' /><br />"); echo("<input type='submit' name='Upload' value='Upload'>"); echo("</form>"); if(isset($Upload)){ echo "button pressed";}
  9. I am trying to insert records from tableA into tableB if the records do not exist in tableB. Here is my sql statement... INSERT INTO str_a1table2( `brands_url` , `brand_name` , `product_url` , `product_name` , `price` ) SELECT `str_a1table1.brands_url` , `str_a1table1.brand_name` , `str_a1table1.product_url` , `str_a1table1.product_name` FROM str_a1table1 WHERE str_a1table1.brands_url <> str_a1table2.brands_url AND str_a1table1.brand_name <> str_a1table2.brand_name AND str_a1table1.product_url <> str_a1table2.product_url AND str_a1table1.product_name <> str_a1table2.product_name I keep getting syntax errors. Any help greatly appreciated! Thanks, Warren
  10. Thanks for your help! This is exactly what I was after. Warren
  11. if($_SERVER['REQUEST_METHOD']=='POST') { $a=$_POST['checkbox']; echo $a; echo "<br>"; print_r($a); } Here are the results: Array <==========results of echo $a Array ( [0] => 27292181.jpg ) <=========results of print_r($a) The value I am looking for is the file name (ie. 27292181.jpg). Thanks for any help, Warren
  12. I am trying to view the value of a checkbox. When I use the code below, I get the value with extra information if($_SERVER['REQUEST_METHOD']=='POST') { $a=$_POST['checkbox']; print_r($a); } The value I am getting from the above code - 'Array ( [0] => mm_r.gif)' ....I just want the actual value - 'mm_r.gif'
  13. Thank you both for your quick replies!  Jesirose, you are correct, it is always 'id'.  The code is exactly what I was looking for.  Appreciate your help! Warren
  14. I am trying to strip data from a URL parameter into a variable. example: www.website.com/product.php?id=redwidgit--1 www.website.com/product.php?id=bluewidgit--2 www.website.com/product.php?id=greenwidgit--3 What I am trying to extract is the number at the end of the parameter (ie. 1,2,3).  The number is always at the end of the parameter and it is after two dashes ('--'). Any help greatly appreciated! Thanks, Warren
  15. Thanks for everyones help!  I really appreciate all the feedback.
×
×
  • 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.