Jump to content

akitchin

Staff Alumni
  • Posts

    2,515
  • Joined

  • Last visited

    Never

Everything posted by akitchin

  1. ... unless the course happens to be falsely advertising itself, then presumably yes.
  2. this is merely a matter of using the modulus operator to check if the counter is even or odd on each iteration of the loop: for ($i=0; $i<$number; $i++) { $location = mysql_result($result,$i, "location"); $image = mysql_result($result,$i, "image"); $div_class = ($i % 2 == 1) ? 'class_if_odd' : 'class_if_even'; ?> <div class="<?php echo $div_class; ?>"> <h5><?php echo "$location"; ?></h5> <a href="../index.php"><img border="0" src="img/<?php echo "$image"; ?>"></a> </div> <br /> <?php } } ?> change the two classes in the line i added to be whatever you want (here, most likely "ac" and "ac2" based on your messages). so you're aware, the modulus operator returns the remainder after dividing by the divisor. here we're using 2, so any even numbers will return 0 (because they're divisible by 2), and odd numbers will return 1.
  3. you're going to have to give us more than that. do you already have styles defined that will put the image where you want it in each case?
  4. Hard coded! now thats a new one on me. How will i know if its hard coded? Also, What sections would output it? I would really like to use this script but, the vender that sells it seems to provide absolutely no support! an excellent reason to employ the "caveat emptor" principle when shopping around for scripts. what i meant by hard-coded is whether the HTML is spit out by the script, or if it's in there statically (just as it would be on a regular HTML page that had no PHP in it).
  5. be sure to check my code again when you come back to this. iève edited it to include END after the CASE block since itès required, and i forgot it when i first wrote the example.
  6. two quick tips: 1. echo the query to see what it's trying to run, in case it isn't what you expect, and 2. make sure you didn't commit a typo when you defined the table (ie. check that it is named col_2).
  7. have a look in the PHP manual at switch: switch. it's basically a slightly more structured way of doing if-elseif-else statements.
  8. <++include function="title_bit"++> those are your problem. if the HTML is hard-coded, you'll need to go through and replace those with the correct characters (the actual less-than and greater-than signs, rather than their HTML entity equivalents). if it isn't hard-coded, we'll need to see the sections of PHP that output it.
  9. have a look at Paypal's IPN documentation. essentially, IPN allows you to tell Paypal to execute a certain script on your server when the payment is passed through - you just need to write the script that will handle this, which entails checking what the payment's result was and then doing the appropriate task based on that result. your best bet is likely to pass them from the paypal button to an interim page (on your server), where you insert the info into a database along with a flag that designates it as an unpaid listing, and header() them onto the Paypal payment page. this could be tricky, since using header() may spark a caution message in the browser (can't remember off the top of my head), but it's worth a shot. then set IPN to point to a script on your server, and if the payment comes back as successful, simply switch the flag in the database to designate that the listing is paid for.
  10. i haven't looked through the whole function, so there could be syntax errors, but the logical reason why the function doesn't work (which although you haven't explained HOW it doesn't work, i assume it's because it's always showing personals) is because it relies on $catkey, which is never passed to the function. function GoogleAd($catkey) { ... } and then when you call it, you'll need to pass it the $catkey variable. this function could be a lot cleaner if you used a switch() statement.
  11. you may want to add LOWER() so that it's a case-insensitive search. SELECT *, IF(LOWER(SUBSTR(name,1,1)) = 'b', 1, 0) AS sorter ....
  12. first off, you don't need anywhere near the number of parentheses or braces you're using in the if() conditional: if ($row['username'] == $_SESSION['username'] ){ second, the issue is with this line: echo "Click to read more about" .$row['username'].; i'm not sure why you're trying to concatenate (attach) the semicolon to your string. remove that period. finally, in order to ensure you're seeing errors, you will want to place the following at the top of your pages until the script is published: error_reporting(E_ALL); ini_set('display_errors', 'true');
  13. consider it broken. [attachment deleted by admin]
  14. we're going in circles here. when echoing the input tag to the browser, DON'T give them a variable variable name. this: "<input name="<? echo $rows['udu_id']; ?>[1][1]" type="text" />" should be: "<input name="question[<? echo $rows['udu_id']; ?>][1]" type="text" />" this will result in the structure i explained above, with output like this: <input name="question[10][1]" type="text" />
  15. you're not allowed to send output to the browser before using a header function, which pretty much any session and cookie functions are. this is in one of the stickies in the PHP Help thread, and is a very common error. the way to fix this would be to move any cookie processing to ABOVE the HTML output in the page, in this case, the "visittime" cookie. chances are the reason you're getting errors even if session_start() is at the very top of the page is that something is still being run before the page you're putting session_start() on.
  16. in this case, one option is to have a final confirmation page (AFTER the user has selected payson as their payment method) with the hidden form inputs as rhodesa has suggested. otherwise, you could have them select the payment method BEFORE entering their information, which allows them to go straight from information entry to payment processor since you're already aware that they need to head that way. the final option, and probably the one that's more work, is going my route and constructing the POST request using sockets or cURL as mentioned above. with so many other options though, it's unlikely that this is worth the effort.
  17. first, you can use ignace's query if you add "LIMIT 1" to the end of it to restrict the set to one. second, in order to check the user's input against the answer, simply put a hidden input into the form containing the question's ID. then on submission, use that ID to summon the answer from the database and check it against the answer the user provided. from there, i presume you're able to do the rest (forwarding the user or showing a button, etc).
  18. another possibility, but i imagine it might be a little over the OP's head.
  19. touché my good man! OP: are you collecting credit card information on your site, or are they collecting it on payson's website?
  20. is there a reason for having the extra key then? it looks entirely redundant, if you could just go: <input name="question[10][1]" type="text" /> <input name="question[10][2]" type="text" /> <input name="question[10][3]" type="text" /> <input name="question[25][1]" type="text" /> <input name="question[25][2]" type="text" /> <input name="question[25][3]" type="text" /> perhaps i'm missing something entirely here.
  21. the only problem is that then you're at the mercy of payson, and are forced to physically send the user there. constructing with sockets allows for seamless integration. both perfectly doable ways, i guess it just depends on the OP's goal.
  22. because that would require the physical submission of the form, unless one was to use javascript to submit the form upon loading of the page, but one should avoid relying on javascript to make their app work.
  23. you will need to loop through each individual textarea and explode the entries on the \n character, presuming that each individual spelling is on a new line: foreach($_POST['additional_spelling'] AS $category => $input) { $separate_entries = explode(chr(10), $input); $_POST['additional_spelling'][$category] = $separate_entries; } echo '<pre>'.print_r($_POST['additional_spelling'], TRUE).'</pre>'; is that more along the lines of what you're looking to do?
  24. it will all be in one gigantic array with the method i suggested. the first key will be the question number, the second key will be the sub-question: echo $_POST['group'][1][2]; // shows the response to subquestion #2 of question #1 the first foreach() will traverse through each individual question, and the foreach() embedded within the first will traverse through each subquestion in each question.
  25. for this, you'll need to use sockets. there's probably some documentation on payson's site. if not, peruse the manual's section on sockets (starting with fsockopen) and maybe hop on over to paypal's development resources, because they have code samples that construct a request in the same way.
×
×
  • 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.