Jump to content

Anon-e-mouse

Members
  • Posts

    38
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Male

Anon-e-mouse's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Evening, In simple, I have a script that loops through members when submitted and sends them a confirmation email for an event. However I don't want to send 200 emails one after the other because Google would get very upset. Thus! I attempted to use sleep() but that didn't function as I thought it would inside the loop. Causing the entire thing to wait for the amount of seconds times the result set. So. Whats would you suggest? Thanks.
  2. While you foreach through the values of the select menu itself you could add a third variable the function doesn't have to expect which is your "sticky variable"? So whenever you call it and you need to stick something to the menu you would simply put that field into the function. Something like: <?php function create_dropdown($array_name, $array_item, $sticky_item = null) { echo "<select name='$array_item'>\n"; echo "<option value='select'>Select…</option>\n"; foreach( $array_name as $v ) { if($v == $sticky_item){ echo "<option value='$v' selected>" . $v . "</option>\n"; } else { echo "<option value='$v'>" . $v . "</option>\n"; } } echo "</select>\n"; } See what I'm getting at?
  3. Hello, You could always start with checking to see whether they have included the "@" character in the post via.. <?php // If they dont have the "@" character.. if(!strstr($_POST['userEmail'], '@')){ // Do something. } ?>
  4. Next time wrap code in code tags, much easier to read. I was thinking more along the lines of the code you use to upload the file but ultimately save it in your table as that is the part thats missing. If you wanted to amend .pdf you could: <a href="<?php echo $rows['Question'].'.pdf'; ?>" target="_blank"> Should work. Although that then forces you to have each file a PDF.
  5. Do you have any code that you can post? It's a bit hard to help without seeing what you are actually doing at the moment..
  6. Hello, Are you uploading the file? If so, can you post how you are? Sounds like you are saving the filename but not the extension..
  7. Hiya, I think I'm reading it correctly but working our way out from the middle you have two array_diffs. Well the difference between the two arrays $a and $b are 0 and 10 being present in $b but not $a. Array_diff works by returning an array with the differing pieces from the two arrays you provide. The below is from php.net So in this case you are creating two new arrays that have both 0 and 10 as items within them which are then merged together and the items are counted. Which is why it returns 4.
  8. Well that is easily solved. If you had a page you could have an icon on each "comment" that would take you to an edit page and then do that for that specific comment, whilst at the bottom (as its usually done) you could have a form which allows you to then post a new comment regardless of whether they have one or not?
  9. Your button you use to submit the form is not contained within the <form></form> tags. Try placing it in and then submitting it.
  10. Or! Alternatively and what I think blacknight was getting as use backslashed to escape the speech marks when within speech marks. Otherwise you will generate that error. Below: <?php echo "</head><body onload=\"ajaxFunction()\";>"; ?> That said, whenever you use speech marks within an echo try and surround the entire thing in apostrophes ('), makes it a LOT easier.
  11. Going on what I've read if you were to store the users ID instead of their username as the session (not that you couldn't do both) you could then use that as your variable to differentiate when querying the tables. <?php $sql = "UPDATE `table1` SET `column1` = '".$toset."' WHERE `userID` = '".$_SESSION['userID']."'"; ?> So you then update the table with your information using the session you set when they first logged in, no reason to say you could assign the session to another variable as you have above and then use it in the query but thats just a quick example.. Hope it helps!
  12. Morning! The group by statement refers to a column, so surrounding it with apostrophes will make the column act as a value, if that makes sense. This should work: <?php $sql = "SELECT * FROM monsterpost GROUP BY mpmonth"; ?> Notice the group by clause is capitalized and the column name you are grouping is not surrounded by apostrophes. If you wanted you could surround it in backticks (`) but it isn't essential in this situation.
  13. Point. You have an extra comma after 'Uploadedfile' which should not be there.
  14. Morning (just), $run if you look is the query actually being executed instead of putting the query inside mysql_query() directly I built the syntax and then input it. So $run becomes the "query" in the sense that whenever you wanted to pull the results you would use that.
  15. Sure, <?php $sql = "SELECT * FROM ....."; $run = mysql_query($sql); while($get = mysql_fetch_object($run)){ if($wordyouarelookingat == $get->word){ function($wordyouarelooking at); } else { continue; } } ?> There you have a really basic example of what I was going on about. Simply you would query the table in order to get your list of words, run through the results and if the word you are searching for is the same as one in the table then you can pass it through the function otherwise it would skip that word and try the next..? Obviously I don't know how you will get the words to highlight in the first place but the above is just one way out of a possible trillion (most likely...) to attempt it. Hope it helps.
×
×
  • 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.