Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. You're not getting YOUR exception message or you are not getting the exception error message?
  2. Lookup the explode function in the php manual. That will help you break apart the string into 3 strings and then you can break apart the first string to drop the last (2) part. Same for the 3rd string.
  3. You state that it isn't sending the email. Is that because you don't receive one or because you get your error message? Would be nice to know. Debugging info for next post: 1 - post any code you have in the proper tags for this forum such as 'code' and '/code' in square brackets 2 - Show us the contents of the mail vars so we can see what you have built. 3 - turn on php error checking
  4. Do you really think we are going to follow what you have just posted now? Another "incomplete" set of code. Can't help you.
  5. So you were talking about output layout and not the 'handling of foreach/while'. Now it is clear. The difficulty with this is the layout. I have done this using an html table but don't remember how at the moment. Another way would be to define a div to hold the data for each column and then to output your results into the appropriate div and then just display the divs side-by-side. In your while loop keep track of which column you need to put this row's result into and then increment that counter. Read up on variable variables in the manual - they would work well for this
  6. I realize this is just a snippet but it is such a small snippet nobody here is going to be able to help you. Here's what it is doing at the moment: if some value ($check) is true you do the following: - save an item called $body into an array called $bodies - for each element of the $bodies array (only one so far!) you assign the element number and the value of that element to $i and $b - you write the contents of $b to a file name based on the current value of $i - which will be strange when $i is a zero at the beginning - THEN you check the contents in $b for some string write a message to something called $filename which we don't know about yet. - if the contents in $b are not the first string you check for another string and again write some message to another thing called $filename in a different folder. and then ??? Just how do you know nothing is being written? Do you get any kind of response from this or just a blank screen? Try turning on error checking (which you should already have on) or using some echo to show what you are doing each time thru this code (something like echo "just wrote $i to $dir/$mailbox" or echo "just wrote EXPIRED contents" or echo "just wrote photo_msg contents". That should help you see what is happening. Be sure to echo out $dir and $mailbox and $file_name at some point to see what they are.
  7. You talk about 'using' the foreach and while operators but then you talk about columns. Don't understand. Those two operators allow you to easily iterate through a collection of "data" easily. Each time thru you can process one piece of that data. To show you: If you have an array of the following: $ar = array('apple', 'pear', 'peach', 'cherry') and you use a foreach on it like this: foreach ($ar as $a) then the code you follow that statement with would operate on $a and you could do something like: foreach ($ar as $a) echo $a."<br>"; Or if you had an array like $ar = array('val1'=>12, 'val2'=>15,'val22'=>22, 'val33'=>29) you could do this: foreach ($ar as $k=>$v) echo "Item $k contains $v<br>"; and the output would look like: Item val1 contains 12 Item val2 contains 15 Item val22 contains 22 Item val33 contains 29 The while loop is a bit different in that it works well on arrays of arrays (imho). Usually when retrieving a set of query results as an associative array (or numeric too) you would do this: $q = 'select firstname, lastname, street1, city, state,zip from address_table where city='Albany'"; $qresults = $pdo->query($q); while ($row = $qresults->fetch(PDO::FETCH_ASSOC) { echo "{$row['firstname']" {$row['lastname']} lives at {$row['street1'} {$row['city']} {$row['state']} {$row['zip']}<br>"; which would echo each row of the query results on a single line of your screen. As you can see the two operators work on whatever data you give them, so your question about "adding columns" doesn't seem relevant here. Hope this helps.
  8. Not sure but there is one thing that should change. The following should change: .. .. $stmt->execute(); $row = $stmt->fetchAll(); if($stmt->rowCount()) { if($row['rank'] == 1) .. .. to this: $stmt->execute(); if($stmt->rowCount()) { $row = $stmt->fetch(); if($row['rank'] == 1) .. .. Note the use of rowcount to determine what to do next and also the use of 'fetch' instead of fetchall. Fetchall will produce an array of rows whereas you only want one row of data to work with here (and should have only one row). If all you want to do is to exit this script and go somewhere else, why the meta echo? Just call header("Location: $url") to go where you want.
  9. Can you show a more complete example? So many things that we don't know about in your current ex. The html? The capture of the input? The whole sequence of that and the query and THEN the check, altho you really don't need a check if you do this correctly.
  10. Do you really think that people here are going to go thru all that code? Do some debugging and isolate where your first problem occurs. Then fix it. Then move on the next problem. Use debugging methods like echoing out values to confirm that what you think s/b happening is what is happening. That's how it's done. And when you do find an error that you need help on - post THAT code here, not somewhere else. I, for one, won't look elsewhere for code that people link us to. Just not my thing. First tip tho- read my signature.
  11. Why not use php to handle the form input and generate the email instead of letting the users supply the 'to' address? Your script can do all the validation necessary and then it can send the email to whatever address you want it to go to - already verified.
  12. Do a query to retrieve the user's name fields. Start the body variable with the "Hi (name_field),\n\n" and then add more text to that message body. PS - You really should be using a different sql interface since MYSQL_* functions are all DEPRECATED. Please refer to the manual if you don't believe me. IMHO - you should learn PDO.
  13. There's nothing wrong with the code that you are showing us. What code is causing the 'battle' to start up again and again? That is where the fault lies.
  14. How about doing some echo-ing of your random number to be sure that is what is happening. Plus - what happens in reloadpage()? Do you reset activeBattle from the value of active in your table that you just updated?
  15. Each element of your array contains a comma separated string of 'key=value' items. 1 - explode each array element into an array using the comma as the separator. 2 - foreach element of this new 'exploded' array do another explode on the = sign and echo out the second element of this new array.
  16. The way to keep from losing your inputs is to use php vars in the value clauses of each input element, hidden or visible. Grab each input value and store it in a php var that is used in the html tag so that when the form is sent back to the client those values are output. Sample: echo "<input type='text' name='street' value='$street'>" where $street is captured during the form receipt by the script: $street = $_POST['street'];
  17. Where is $from defined? Show us your new code too.
  18. Did you connect to your database and assign $stmt? You don't check any results so you can't be sure, can you?
  19. You need to use ".=" when trying to concatenate pieces of the header together.
  20. Your code is the worst thing I've ever seen posted here. Of course it won't work! That said - just what are you trying to do here? Why would you want to send your users to THREE sites at the same time? Whatever is the point of that? And just how are you going to present these sites to the client? Three separate tabbed windows in your browser? Great! I'm happily browsing along and you have this link that I click on and suddenly my browser explodes with stuff! Or as was suggested, you use a JS function (I hope you can write js functions better than you attempted to write a php one!) that will pop up 3 new windows (users just LOVE when that happens!) over the existing window. Is that what you are picturing? Yes - this is harsh, but really - think about what you are proposing.
  21. ginerjm

    how to ?

    Still have no idea what you want
  22. Do your trains/buses have intermediate stop? Or do they simply go from Bagan to Yangon without stopping anywhere in the middle? If so you need to be able to identify the train that they need to get on. Do you have to concerned about how many seats are available for any bus/train? If so you need to keep track of how many tickets have been sold for each train/bus Things to think about.
  23. I didn't say you could do it on your own. I said if you had some code then people here would help you, but if you don't know where to begin then perhaps you need to hire someone.
  24. ginerjm

    how to ?

    You need to be more specific with your terms and with your writing of English. Have no idea what all you want to do. 1 - you can't open a "website" with the user not being able to see it. What's the point if the user can't see it? 2 - Any fast way to do WHAT? User Curl? Finish the project? 3 - How does this user "give you a website"? What do you mean? People will probably not respond to you until you make some kind of sense here.
  25. If you are looking for a coder perhaps you should look in the jobs or 'coding for hire' forums. We're here to help those who are trying to program
×
×
  • 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.