Jump to content

citricsquid

Members
  • Posts

    46
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

citricsquid's Achievements

Member

Member (2/5)

0

Reputation

  1. Let's say I have the following strings: dsfdfsfdd/48977856+FE_F)E_E/dfhjdjhsd/sdffdsfsd/dsfsdfsdfp dsfdfsfdd/123p dsfdfsfdd/41234/1234324/3243223/324234 and I want to match the very final value after /, so It'd match: dsfdfsfdd/48977856+FE_F)E_E/dfhjdjhsd/sdffdsfsd/dsfsdfsdfp dsfdfsfdd/123p dsfdfsfdd/41234/1234324/3243223/324234 I know how to find the first, but not the last! Thanks!
  2. Just wondering, is there any reason you're not doing it the obvious way by having a default file (eg: view.php) and passing an ID then showing the information? Do you need to create files?
  3. Line 317/318, the input box. So you want: echo "<td><input id='referral' type='text' name='6' value=\""; if(isset($_GET['href']) && $_GET['href']!=''){ echo $_GET['href']; } echo "\" class='input'></td>"; Try that instead, it's easier to read and modify.
  4. If I had to guess; register_globals? You'll need to start using $_POST['variable']; Instead of $variable for things passed via the form.
  5. You probably shouldn't be having an ID that isn't non-unique and auto_increment. If someone wants to link to a post the ID is normally what would use, but if that can be changed... Instead have a unique ID and an order value; order can simply reflect the ID until it's changed.
  6. You need to change all the variables taken from the previous page to $_GET['name'] or $_POST['name'] depending on the method they're passed with. For example in your script you have "if($create)" but $create isn't defined anywhere, so I assume the form passes it, correct? If so above this line you should have "$create = $_GET['create']" (or $_POST).
  7. My method is slightly more complicated, but a lot more secure. You'll need a script for generating the dump, a script for activating the backup and a script for receiving the backup (listen). 1. user loads up the form page and clicks submit (or whatever you want them to do to trigger it) 2. The live server starts to generate a backup 3. once the backup is generated the live server sends the backup to the "listen" script on your backup server 4. The listen script then runs the query. For example: website1.com/form.php -> user clicks "generate backup" -> request sent to "website2.com/dump.php" -> website2.com/dump.php generates a sql dump -> website2.com/dump.php sends the dump to website1.com/listen.php -> website1.com/listen.php runs the query. This means the user will never see the data, it'll all be transfered behind the scenes. Apologies if I explained it poorly, this is a graphic created by Paypal that shows how I mean: https://cms.paypal.com/cms_content/US/en_US/images/developer/IPNOverview.gif
  8. Your problem is that your old server had global variables enabled (which is bad) and your new doesn't. How is $menusel defined? From $_GET? if so: $menusel = $_GET['menusel']; at the top of your page.
  9. So I've been thinking about it and I think it'd be possible to just do "where eggs = '$number' AND eggs ='$number+1' AND eggs ='$number+2'" (in proper query syntax). However let's say I need to do it for 100 different numbers, will this be a big hit on the database (performance wise)?
  10. I have a database of values and I want to work out how to display them if the values match a consecutive pattern. For example, I might have the table "eggs" with the values "1", "2", "3", "4", "6", "7", "8", "9", "10". Now if I were to count these up I'd have 9 total values, this is good. What I want to do is ONLY count the values where they have another 2 consecutive values after them. So for example if the above pattern is what I'm using and I want to check for 2 consecutive values, the following would happen: 1 -> correct, it is followed by "2" and "3". 2 -> correct, it is followed by "3" and "4". 3 -> false, it is followed by "4" but no "5" 4 -> false, it is followed by "6", no"5". 6 -> correct, followed by "7" and "8". 7 -> correct, followed by "8" and "9". 8 -> correct, followed by "9" and "10". 9 -> false, followed by "10" but no "11". and this would return the total of 7, because 7 of these values are followed by 2 consecutive numbers, therefore are correct. So my question: How would I go about this? Would it be a matter of a single (albeit complex) mysql query or will I have to do some more advanced stuff after fetching the array? If it's the second I can do that myself, but I'd like to (hopefully) do it in a query! So, any ideas?
  11. The simplest solution is to have the login page (one with the input form) add the referrer to their session, you don't need to store the referrer on every page, only the login. You'd have to add exceptions for no login and external sites though.
  12. If the server supports it then <?=... is a workable replacement for <?php echo... albeit bad practice.
  13. <?php //Söker funktionär med namn if(isset($sok)){ $query = "SELECT * FROM funktionarer WHERE namn LIKE '%$namn%'"; $result = mysql_query($query); if(!$result){ echo "<div class=tabell4><table><tr><td>Funktionären kunde inte hittas. MySQL rapporterar: " . mysql_error() ."</td></tr>"; echo "</table></div>"; } else { $line = mysql_fetch_assoc($result); $s_namn = $line['namn']; $s_adress = $line['adress']; $s_postnr = $line['postnr']; $s_ort = $line['ort']; $s_tel = $line['tel']; $s_email = $line['email']; ?> <form method="post" action="<?=$PHP_SELF?>"> <table><tr> td width="128" class="text_12">Namn</td><td width="131"><input type="text" name="namn" size="22" value="<?=$s_namn?>" /></td></tr> <tr><td class="text_12">Adress</td><td><input type="text" name="adress" size="22" value="<?=$s_adress?>" /></td></tr> <tr><td class="text_12">Postnr</td><td><input type="text" name="postnr" size="20" value="<?=$s_postnr?>" /></td></tr> <tr><td class="text_12">Ort</td><td><input type="text" name="ort" size="20" value="<?=$s_ort?>" /></td></tr> <tr><td class="text_12">Telnr</td><td><input type="text" name="tel" size="20" value="<?=$s_tel?>" /></td></tr> <tr><td class="text_12">E-mail</td><td><input type="text" name="email" size="20" value="<?=$s_email?>" /></td></tr> <tr><td class="text_12"> </td><td> </td></tr> <tr><td class="text_12"><input class="skicka_knapp3" type="submit" name="sok" value="Sök funktionär" /></td><td> </td> </tr> </table> </form> <?php } } // Stänger anslutningen till vår databas mysql_close($connection); ?>
  14. Apologies, I'm not the best at explaining. I have some data, an example of the data is as follows: ID | Type | Age | Name 01 | CAT | 12 | JOHN 02 | DOG | 13 | EDWARD 03 | HORSE | 02 | MARY 01 | CAT | 12 | JOHN I want to stick this data into an array and then I want to strip out the duplicates by ID, so if the ID is the same as another I want to remove it from the array. However the key (?) cannot be the same as another and I only *think* array_unique supports removing by duplicate key. Does this make sense?
  15. I have some data that I'm putting into an array, the data is as follows: non unique ID (can occur multiple times), name, description and colour. Now, once I've compiled all the data I want to strip out the duplicates by ID, so if I have 3 with the ID of 8, I only want to display 1 of these. $id = 1; $name = "name"; $description = "description"; $color = "colour"; $array[$id]["name"] = $name; $array[$id]["description"] = $description; $array[$id]["color"] = $color; However if I try and do array_unique (assuming I have multiple $id) it doesn't work. Is there anything I should know? Must an array key be unique? If so; how can I use the id as the thing for array_unique to try against? I've read the manual multiple times and I can't work it out. Thanks :3
×
×
  • 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.