Jump to content

compguru910

Members
  • Posts

    37
  • Joined

  • Last visited

    Never

Everything posted by compguru910

  1. In order to use sessions "buffered" (which means where they are not 'SUPPOSED' to be used is ob_start (which you put before the <html> tag on every page, and ob_end_flush at the end of your page, after the </html> tag. Sessions are supposed to be used before anything is written to the page, such as any html tags, thats why buffers are useful. So, before the html tag, put ob_start() and after the closing html tag put ob_end_flush(). This will aleviate alot of the problems. I dont know why you are using an array either. How I add items to my cart was. 1st, you create a link on your item that goes to blahblah.php?add_item=1 2nd, you need to create the function that adds the item, and most importantly, takes you off of that page, and gets rid of the add_item completely, or it will add 2 everytime you do it. Took me forever to figure that one out. and that should be it. What are you trying to use the sessions for. Are you using a table to track all of items in their shopping cart, or an array? Mine works off of a table inside of a database that stored information like the id of that entry into the table, the item id number, and the basket id (which is pretty much the id of the shopper) then I just had the cookie/session store the basket id on the shoppers computer so that whenever you needed to view the cart, it just looked up their basket id in the table, and that was all of their items. If you need help, [email protected]
  2. Try this with your query if (mysql_query($query)) { blah blah } else { print "There was an error with MySQL, the error was " . mysql_error() . " The query was " . $query; } Thats a great debugging script for MySQL. IF you are using PHPmyadmin, then you can past that query that it submitted into the SQL section of PHPmyAdmin, and it will show you the results, if any. That way you can see if it is a q
  3. Ok, here I am again with another question that, if I could get answered would save me alot of time. Heres the scenario if you woud... On my crime stoppers website, you have the option to add a crime through forms and a database, easy, right. Well, when the user wants to add a crime to the website, they have to select from this drop down menu/list box, the type of crime it is. This list box's values are all dynamic because the types of the crimes are stored in another table so that as the need arises, instead of having me add a type of crime through code, and updating every page that has this list box, they can add it themselves. Well. The problem arises when they go to make a change to a crime that they added, how do I make it so that the type of crime they selected, is still selected when they get to the page. I was wondering if anyone has ran into this before and found a solution. Thanks in advance guys.
  4. Im a little confused. Are you tying to pull that same information twice from within the same loop? If so, you would run your query again in the loop, but, when you retrieve the results, instead of storing it in the variable row['user_nick'] like you did the first time, you would store it in row2['user_nick']. But, thats just a guess because I cant tell exaclty what you are trying to do.
  5. That really doesnt make sense. Why would you want PHP to write PHP when you can use functions?
  6. I may be wrong but shouldnt it be \n\r as in new line, return for windows based machines, where as *nix machines are just \n and they automatically follow through with the return?
  7. That code should have worked. I tested on my server and it worked fine. I believe this to either be a server issue, or a php.ini error. I believe there to be a setting in there that allows for redirection with PHP. Are you renting a server/domain, or is this on your own machine. And what version of PHP are you running?
  8. Here, this might help more. I pulled this out of a script I use. It doesnt send a reply message, but, it definately sends the message to you. So all you need to do is make a predefined message to go to the end user, and wala. if (isset($_POST['submit'])) { print "Post detected"; if (!$_POST['name']) { print "<p>You must enter your name</p>"; } if (!$_POST['email']) { print "<p>You must enter your email</p>"; } if (!$_POST['phone']) { print "<p>You must enter your phone number</p>"; } if ($_POST['name'] && $_POST['email'] && $_POST['phone'] && $_POST['comments']) { $email = $_POST['email']; $name = $_POST['name']; $phone = $_POST['phone']; $date = date('g:i a l F j Y'); $body = "Comment Sent By $name \n$email \n$phone \nat $date\nComment: $comments"; mail('[email protected]','Comment',$body); } }
  9. Wow guys, thanks. I have been programming in PHP for a year now and I had no idea about that. You guys are great. Kudos to you
  10. From what your saying, and what that script is saying, I think you have it way over complicated. Try something like this //Checks to see if the submit button on the page was hit if (isset($_POST['submit'])) { $commenters_email = $_POST['email']; $comment = $_POST['comment']; $message_body = "Make up your message to the sender here, remember to use \n for new lines"; mail ('[email protected]','subject line',$comment); mail ($commenters_email,'Reply',$message_body); } Hope that this helps!
  11. Ok, I am having a problem, and I do not know how to go about fixing it. I am designing a website for a local crime stoppers organization and everything was going fine until this. I have made it so that they can upload crimes through a set of forms, so that they will display on the website. Well, when you enter a long description of the crime with multiple breaks in it, and submit it, it stores it in the database. But, when I tell it to print to the screen, it takes all of the breaks out, leaving one big paragraph. Anyone know how to fix this? Shaun example here http://www.n-volved.com/stopcrime/crimes.php?crime_lookup=31
×
×
  • 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.