Jump to content

RussellReal

Members
  • Posts

    1,773
  • Joined

  • Last visited

Everything posted by RussellReal

  1. you need == ((value == value) && (value == value)) is called if nesting, or thats what I call it.. its used to GROUP conditionals together for example if (((value4 == value1) && (value1 == value3)) || (value2 == value4)) { } && = and || = or
  2. well.. in the script I altered for you.. I expect a GET variable called 'page' so you'd just do whatever.php?page=2 3 4 etc
  3. when you stream a video, that video is actually being sent to the clients as they're watching it.. so either way you're sending the video file for the world to have access to..
  4. change $increasegold = mysql_query("UPDATE resources SET gold = gold + '$amount'") to $increasegold = mysql_query("UPDATE `resources` SET `gold` = `gold` + '$amount' WHERE `playerid` = '{$playerid}'")
  5. #1 $SQL = "SELECT * FROM users WHERE username = '{$username}' "; $result = mysql_query($SQL) or die(mysql_error()); $row = mysql_fetch_array($result); $pin = $row["pin"]; $user = $row["username"]; $level = $row["level"]; $active = $row["active"]; is not needed.. get all that data from the second query #2 do the checks for if user is invalid or w\e BEFORE you do queries.. #3 on your localhost you probably have the database set up.. on the server your database probably has errors.. like wrong types.. no table at all, misspelled table name.. etc etc
  6. for str replace you don't need to match the number of TO-REPLACE strings with WITH-REPLACE for example echo str_replace(array("abc","def"),"","abcdefghi"); // ghi
  7. also bro, not to contradict you.. but globals are very much unneeded.. there is a much better way with referencing the variable in the function call $omg = "lmao"; whatever($omg); function whatever(&$geeze) { // $geeze will be a variable accessing $omg, instead of just handling teh VALUE of $omg.. meaning any change you do to $geeze in here, affects $omg.. }
  8. what? pagination is really easy, particularly if you are paginating sql results.. LIMIT works wonders
  9. *** RussellReal extracts foot from mouth *** *** And then inserts directly up the rectum of mjdamato ***
  10. ok for example: you have a table `menu_table` now.. the construct on this table is: int `id` auto_increment text `page` text `options` a fake entry of this table: `id` = 1 `page` = index.php `options` = a:3:{i:0;a:2:{i:0;s:4:"HOME";i:1;s:9:"index.php";}i:1;a:2:{i:0;s:8:"SERVICES";i:1;s:12:"servives.php";}i:2;a:2:{i:0;s:9:"DOWNLOADS";i:1;s:13:"downloads.php";}} how we arrived at the options to look that way is rather simple to manage: <?php $arr = array(); $arr[] = array("HOME","index.php"); $arr[] = array("SERVICES","services.php"); $arr[] = array("DOWNLOADS","downloads.php"); $options = serialize($arr); ?> to undo the serialization is simple.. <?php //do your mysql stuff here and read from the table for the current page $arr = unserialize($row['options']); $arr[] = array("PAGE TO ADD","PATH/TO/PAGE.php"); $options = serialize($arr); I'm sure you could bridge something off of this to simplify the means of building menues for each of your pages
  11. hes trying to round to .5 intervals.. not like 1.5 to 2.0 1.5 would be 1.5 1.6 would be 1.5 1.4 would be 1.5 1.2 would be 1.0 thats why I wrote the function, everybody knows about round() EDIT:: oo I see what sasa did
  12. the MSN add is always on the table incase you need any help in the future that way you don't need to rip your hair out for 10 hours
  13. oh sorry bro it should be greater than instead of less than for the second if.. <?php $page = $_GET['page']; $rpp = 4; $c = 0; $handle = opendir('comments/'); if($handle) { while(false !== ($file = readdir($handle))) { if(preg_match("/\w+(.gif)/",$file)) { $c++; if ($c > (($page * $rpp) + $rpp)) break; if ($c >= ($page * $rpp)) { echo "<div class='update_pics_frame'>"; echo "<div class='update_pics'>"; echo "<a href='comments/$file'><img src='comments/$file' width='200'border='0'></a>"; echo "</div>"; echo "</div>"; } } ?>
  14. if you disabled auto increment your rows will require you to send an ID along with the INSERT, now, you could do without the ID row all together, however, that will lead to optimisation problems as you will have more than likely many results for 1 SELECT query, where as with an `id` you have unique rows throughout the table,, If you'd like you could add me to MSN RussellonMSN[at]hotmail.com
  15. <?php $page = $_GET['page']; $rpp = 4; $c = 0; $handle = opendir('comments/'); if($handle) { while(false !== ($file = readdir($handle))) { if(preg_match("/\w+(.gif)/",$file)) { $c++; if ($c > (($page * $rpp) + $rpp)) break; if ($c <= ($page * $rpp)) { echo "<div class='update_pics_frame'>"; echo "<div class='update_pics'>"; echo "<a href='comments/$file'><img src='comments/$file' width='200'border='0'></a>"; echo "</div>"; echo "</div>"; } }
  16. and id is probably auto increment so you probably wouldn't want to.. what you should do... is ORDER BY and order it by PID
  17. make a menu table use serialize to group values together.. in pairs OPTION -> VALUE $opt = serialize(array("option","value")); then store that into a db with all the other option serialisations seperated by \x01 or something unconventional then when you're going to place the next level in call that menu from the db and unserialize all the options and then place the options where they belong.. then you just need a menu table instead of a hundred text files for each menu.. and its easier to work with in terms of coding the admin panel
  18. <?php print_r($propExterior); ?> you will get something like.. Array ( [KEY] => VALUE [KEY] => VALUE [KEY] => VALUE )
  19. add me to MSN I actively help most of the people on my friends list with PHP and MySQL so you would fit in nicely.. I also have done few tutor jobs for money but I prefer to help for free. My name is Russell and my MSN is RussellonMSN [AT] hotmail.com also: try <?php print_r($_POST); ?> to see if your values r being sent, and the construct of the print_r will tell you how you should reference the values
  20. well yes if you use a font with fixed widths but there is another way that I just found out recently aswell for images.. the function is imagettfbox
×
×
  • 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.