Jump to content

wisewood

Members
  • Posts

    226
  • Joined

  • Last visited

    Never

Everything posted by wisewood

  1. depends on the version of phpmyadmin. I've got completely different one at work to the one i have at home lol
  2. one quick thing... the FaultID is $_GET[ID].... so the faultID should be set as whatever ID is in the URL.
  3. Could you give me a mysql export thing of your table structure and content (if its not secret) and i'll run a few tests on my server for you and see if i can come up with anything. Would like to help, but i dont have time to try and create the table from scratch.
  4. I created something the same just last week. This is pretty much what i did. My table has a field which is updated with 1 whenever a message is read... then in the inbox i have something like this; if($read<1) {$image="<img src=images/unread.jpg>"} else {$image="<img src=images/read.jpg>"} For mine, unread is an illuminated lighbulb, and read is not illuminiated. I didnt do anything with sessions
  5. This was easy to code, but i've tried half a dozen times to explain what it does and I can't lol it's hard to explain. Basically... 1. Is the closing time number less than the opening time number? YES - We're open after midnight. NO - We're not open after midnight. 2. Compare the time now against the opening time, and then against the closing time. If it falls between them the place is open, if not, it's closed. Hope this makes sense for you. [code] <?php         if($closing_time<$opening_time) {             if($time_now<$opening_time)         {         if($time_now<$closing_time)             {             echo "WE'RE OPEN";             }         else             {             echo "WE'RE CLOSED";             }         } } else {     if($time_now>$opening_time)         {         if($time_now<$closing_time)             {             echo "WE'RE OPEN";             }         else             {             echo "WE'RE CLOSED";             }         } } ?> [/code]
  6. This is just a guess, so don't strap me down and flog me to within an inch of my life if i'm wrong (i'd only enjoy it if you did)... Won't the "gibberish" on the front end of the delivered message be appended by the server it passes through before delivery to the phone? If this gibberish is not in your ocde, it must be appended somewhere else along the route.
  7. I used a SAMS teach yourself in 24 hours book. I knew enough that the first dozen chapters, if not more, were of no use to me, but towards the end it was pretty useful stuff. You could pick up some quite useful tutorials online though, which will help you along your way.
  8. I dont know the name of the field you have your numbers 1-32 in, so i've called it ID. I have assumed there is an auto-increment field on table2 called 'id'. [code] <?php // SELECT 32 ENTRIES FROM table1 in random order $strSQL = "SELECT * FROM table1 ORDER BY rand() LIMIT 32"; $result = mysql_query($strSQL) or die ("Invalid query"); $num = mysql_num_rows($result); $count = 1; // FOR EACH RESULT, INSERT THE NUMBER INTO THE randomnumber FIELD OF table2 for($i=0;$i<$num;$i++) { $number= mysql_result($result,$i,"number"); $insert_qry = "UPDATE table2 SET randomnumber=$number WHERE id=$count"; $insert_rslt = mysql_query($insert_qry); $count++; } ?> [/code] It might not do exactly what you want, and might not be 100% coded right as i've not tested it, but it should point you along the right path. The important thing is to SELECT FROM table1 ORDER BY rand() and then to update one entry in table2 for each of the 32 results. If you wanted to update 32 random results in table2, and table2 contains a lot more than 32 entries... [code] <?php // SELECT 32 ENTRIES FROM table2 in random order $strSQL = "SELECT * FROM table2 ORDER BY rand() LIMIT 32"; $result = mysql_query($strSQL) or die ("Invalid query"); $num = mysql_num_rows($result); $count = 1; // FOR EACH RANDOM RESULT, INSERT $count NUMBER INTO THE randomnumber FIELD OF table2 for($i=0;$i<$num;$i++) { $id= mysql_result($result,$i,"id"); $insert_qry = "UPDATE table2 SET randomnumber=$count WHERE id=$id"; $insert_rslt = mysql_query($insert_qry); $count++; } ?> [/code] Hope this is of some use, or i've wasted my time lol.
  9. I have a function in place at the moment on my intranet system which displays the URL of the page currently being viewed by an intranet user. This is quite useful as you can look at the same content they are... However, I would ideally like to be able to view a scaled down version of that page, like a thumbnail... I know you can create an image on the fly with GD, but is there a way to take the URL and convert its contents into an image? I've been looking into it and just can't think of a way to go about it.
  10. AJAX is the most effective way to do it. Just do a quick google for "AJAX Tutorial" and you should find something that you can adapt to your needs.
  11. clever. If you wanted to get really clever you could do the same thing using AJAX, which would allow you to do all the same stuff but without refreshing the page.
  12. if you are really that set on having it check the database for an update, why not have an autoincrementing integer for each entry... then use a javascript timer to run a query on the database every XX seconds/minutes or whatever. Compare the integer of the last entry of the table with the integer of the last integer of the table this time, and send an email if they're different. It's a hell of a hassle when you could do as said and insert one line of code into the script thats already there though.
  13. [code] <?php     function selfURL()     {     $s = empty($_SERVER["HTTPS"]) ? ''     : ($_SERVER["HTTPS"] == "on") ? "s"     : "";     $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s;     $port = ($_SERVER["SERVER_PORT"] == "80") ? ""     : (":".$_SERVER["SERVER_PORT"]);     return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI'];     }     function strleft($s1, $s2) {     return substr($s1, 0, strpos($s1, $s2));     }          $this_url = selfURL();     echo "<b>The full URL is:</b> $this_url<br><br>";          $slash_pos = strrpos($this_url, "/");     $pos = $slash_pos + 1;     $image = stripslashes(substr($this_url, $pos));     echo "<b>The image name is:</b> $image<br><br>" ?> [/code] if you then do <img src="<?=$image?>"> you will be able to use the image variable snatched from the end of your URL as your image. I think this does what you were after...
  14. you can set it up however you like... [code]if($auth_level>1) { echo "secure stuff"} else {echo "you dont have permission!"}[/code] Thats the way i would (and have) done things. I have an intranet site which has a standard appearance, with options to carry out certain functions etc, but if $auth_level is greater than 1 (one being standard user auth_level) then i display additional buttons etc. Works well.
  15. remove your server, username and password from your example of the code you use... otherwise you leave yourself wide open to attack from someone not so nice as me. Try this: [code]$query = "SELECT * FROM info WHERE first='$first' AND last ='$second'";[/code]
  16. this is my script for doing what you want... cant remember where i got it from... its a bit rough, but it works. <?php $bareQuery = "SELECT * FROM your_table"; $queryall = $bareQuery.$sorted; $resultall = MYSQL_QUERY($queryall); $numberall = mysql_Numrows($resultall); if ($numberall==0) { echo "No Results Found !"; } else if ($numberall>0) { $x=0; ?> <table> <? while ($x<$numberall) { if (($x%3)==0) { $row="</tr><tr><td class=report>"; } else { $row="<td>"; } ?> <? echo $row ?> <td> <?=$some_variable?> </td> <? $x++; } // end while } // end if numberall > 0 ?>
  17. splitting the results into two columns as follows; 1 | 2 3 | 4 5 | 6 7 is straight forward... but i'm looking for a way to do; 1 | 5 2 | 6 3 | 7 4 | and haven't figured out how to do it yet. If you find anything, please let me know...
  18. sounds to me like you are using a script which expects you to have Zend Optimizer installed, and you haven't. Head on over to zend.com and download/install the optimizer and you're heading in the right direction. Zend is the programming group/company who develops php stuff.
  19. ok, within your mySQL database you'll want to create a 'users' table. userid, username, passwordforename, surname, auth_level (for example). You input the users into the table, and assign them their auth_level accordingly (1, 2 or 3). Then, within your script to process their logging on to the system, have it pick their details from the table, including their auth_level and set it into the session variables. Then if you have "secret" pages, you simple have something like this; if($_SESSION['auth_level'] >= "2") { echo "let them see it"} else { echo "Keep them out"}
  20. your_page.php?var=something $variable = $_GET['var']; $variable will now be "something" You can then use <?=$variable?> to insert it into your html object or whatever.
  21. UPDATE '[!--coloro:#FF6666--][span style=\"color:#FF6666\"][!--/coloro--]$compl' [!--colorc--][/span][!--/colorc--]SET '$colnom' = '$pos' WHERE `Name`='$name'") I am not seeing anywhere where you are declaring what $compl is. If it doesnt know what $compl is supposed to be, then the update query doesnt know what table it is meant to update. hope this helps.
  22. No time to explain... but this is what i use to create the same effect. "" if (($x%2 "" is the bit that does the business... if you wanted to increase your table columns to 3, 4, 5 or whatever... just replace the 2 with the number of columns you need. Hope this helps you find a way to what you want to do. [code] <?php $bareQuery = "SELECT * FROM My_Table"; $queryall = $bareQuery.$sorted; $resultall = MYSQL_QUERY($queryall); $numberall = mysql_Numrows($resultall); if ($numberall==0) {     echo "No Slackers Found !"; } else if ($numberall>0) { $x=0; ?> <table class="content" align="center"> <? while ($x<$numberall)       {            if (($x%2)==0) { $row="</tr><tr><td>"; } else { $row="<td>"; }              echo $row ?> [/code]
  23. TOP 10... SELECT * FROM table WHERE rating > '' ORDER BY rating DESC
  24. if each item in your table has an id number... something similar to that below would work. [code] <a href="delete_entry.php?id=<?=$id?>">Delete This Entry</a> [/code] [code] <?php $id = $_GET['id']; $query = mysql_query(DELETE * FROM your_table WHERE id_field = $id); ?> [/code] Might not be exactly right, but it will nudge you along the right path.
  25. are you using select * from 'table' or specifying only the fields you need for each query? selecting for example... SELECT field1, field2, field3 FROM table this can use much less cpu & memory
×
×
  • 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.