Jump to content

pocobueno1388

Members
  • Posts

    3,369
  • Joined

  • Last visited

    Never

Everything posted by pocobueno1388

  1. <?php $twoYear = date('Y-m-d', strtotime ("+ 2 year")); echo $twoYear; ?>
  2. You need to use sessions to create a shopping cart. If you have all these questions, your obviously not ready to take on programming your own shopping cart. I suggest reading tutorials to learn the basics of PHP.
  3. It's in an array when you call it from the database. <?php $query = mysql_query("SELECT * FROM table"); //Make $row an array of DB values $row = mysql_fetch_assoc($query); //Now you can echo values out from the array echo $row['val']; ?>
  4. Try this WHERE projects.due_date BETWEEN {$_GET['date1']} AND {$_GET['date2']}
  5. Change it to this case substr($veh_cat,0,1)=='B': EDIT: This code is tested, and works <?php $veh_cat = 'Abcde'; switch ($veh_cat){ case substr($veh_cat,0,1)=='A'; echo "Works"; break; default: echo "default"; } ?>
  6. From searching Google, a common solution was to reboot the server. Are you using Apache?
  7. I take that back...I just tried the example code from the manual, and I am getting the same error 0_o I have no idea why it's doing that...
  8. Do you have header("Content-type: image/png"); at the top of your script?
  9. Post your code, I don't think your using it right.
  10. Well, I guess we're going to have to agree to disagree.
  11. hehe if you use databse that is not "shopping basket" or shopping cart that is called wish list Why couldn't you use a database to store what is in their shopping basket? Makes sense to me...if you want the items to be "remembered" for a long period of time, sessions aren't going to cut it. There are multiple ways to do things in PHP, so there isn't really a wrong way. It just all depends on what the person wants.
  12. <?php $query = mysql_query("SELECT COUNT(*) as num FROM table WHERE category='California'"); $row = mysql_fetch_assoc($query); echo $row['num']; //<-- This will echo out how many rows ?>
  13. Depending on how you want it to work, and your website setup a database can be used as well.
  14. Check out this function http://us.php.net/manual/en/function.imagettftext.php There are also plenty more you can look through here if thats not what you want http://us.php.net/gd
  15. Some of the images displayed as the "Random Image" are stretched. You should only resize the image if it is bigger than what you want it.
  16. You just need to add the orderID to your WHERE clause. SELECT * FROM Orders, OrderDetails WHERE Orders.OrderID = OrderDetails.DetailOrderID AND Orders.OrderID = '$OrderID' See if that does what you want.
  17. Here is a whole topic dedicated to editors http://www.phpfreaks.com/forums/index.php/topic,119433.0.html
  18. Try this...this will tell you exactly what IF statement is giving you problems, post what you get. <?php if ($action == "sub") { echo $emailPost; if (empty($emailPost)) { echo("Please enter an email address! <a href=\"index.php\">Go back</a>.<br />"); } else { $res = mysql_query("SELECT * FROM newsblitz_list WHERE email_addr = '".$emailPost."'") or die(mysql_error()); $row = mysql_fetch_array($res) or die(mysql_error()); if ($row['email_addr'] == $emailPost && $row['gets_mail'] == 1) { echo("<strong>$emailPost</strong> is already subscribed to $news_name! <a href=\"index.php\"> Go back</a>.<br />"); } else { if ($row['email_addr'] != $emailPost) { $date = Date('m/d/y h:ia'); $query = "INSERT INTO newsblitz_list (fname,email_addr,date_subscribed,gets_mail) VALUES ('$name','$emailPost','$date','0')"; $res = mysql_query($query) or die(mysql_error()); $name = $_POST['name']; $confurl = "http://nnnnnn.com/mailer/index.php?action=conf&addr=$id,".md5($emailPost); $subject = "[$news_name] Newsletter Confirmation"; $message = "$name,\n\nSomebody (hopefully you) has chosen to subscribe this email address to $news_name.\n\nIf you would like to receive our newsletter, then please confirm your subscription by going to the confirmation URL below. Otherwise, you can safely disregard this message. \n\nThanks,\n$admin_email\n\nConfirmation URL: $confurl\n"; $from = $from_email; $headers = "From: $from"; mail($emailPost,$subject,$message,$headers); echo("<strong>$emailPost</strong> has been subscribed to $news_name. Please check your inbox; you'll receive an email shortly to confirm your subscription. <a href=\"index.php\">Go back</a>.<br />"); } else { $id = $row['id']; $date = Date('m/d/y h:ia'); $confurl = "http://nnnnnnnnnnn.com/mailer/index.php?action=conf&addr=$id,".md5($emailPost); $subject = "[$news_name] Newsletter Confirmation"; $message = "$name,\n\nSomebody (hopefully you) has chosen to subscribe this email address to $news_name.\n\nIf you would like to receive our newsletter, then please confirm your subscription by going to the confirmation URL below. Otherwise, you can safely disregard this message. \n\nThanks,\n$admin_email\n\nConfirmation URL: $confurl\n"; $from = $from_email; $headers = "From: $from"; mail($from,$subject,$message,$headers); echo("<strong>$emailPost</strong> has been subscribed to $news_name. Please check your inbox; you'll receive an email shortly to confirm your subscription. <a href=\"index.php\">Go back</a>.<br />"); } else { echo "I don't think you will get this one..."; } } else { echo '($row[email_addr] == $emailPost && $row[gets_mail] == 1) not working right...'; } } else { echo "I hope you dont' get this error..."; } } else { echo '$action == "sub" not set'; } ?>
  19. No it doesn't, the query could still return more than one row thus going through the while loop multiple times. Yes, but that is not what I meant. They had put $i in their query, and the for loop only runs once, so $i would only be equal to 1. I thought they were trying to change the query up for each iteration of the loop, but that wouldn't work since $i wouldn't change. I was thinking more along the lines of it only displaying one set of results. I worded that last post horribly.
  20. It should only display one result, because that is what your telling it to do with the for loop. Explain exactly what your trying to do.
  21. Yep. Looking back at my first website that I programmed to help myself learn PHP, it's quite embarrassing. I think everyone has their ugly and inefficient coding days from back when they were first learning. Then again, the people looking back and laughing at there own coding will probably look back at the code they are doing now in a few years and have the same thoughts now that they did the last time around. You are always learning, so looking back you are bound to always find something to laugh about.
×
×
  • 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.