Jump to content

taith

Members
  • Posts

    1,514
  • Joined

  • Last visited

Everything posted by taith

  1. if i knew what the $sitetitle function is... probably not... it'd take alot of code for a function to automatically switch from full path to relative path with 100% accuracy... twood be quicker to just change it manually from your database... i'm sure i could make one to switch from full to relative path... but tha'd prolly take a while lol
  2. $directory = "../../photos/thumbs/Set1/"; ../ and ./ are for relative path, not full
  3. ./ <-- current directory ../ <-- parent directory
  4. for example... login.php [code] <? if(!empty($_POST)){ $username=$_POST[username]; $password=md5($_POST[password]); $result=mysql_query("SELECT * FROM users WHERE `username`='$username' AND `password`='$password' LIMIT 1"); $row=mysql_fetch_array($result); if(!empty($row)) $_SESSION[user]=$row; else die("Invalid Username/Password"); } ?> [/code]
  5. not that i know of... but you can always [code] foreach($_POST as $k=>$v) echo '<input type=hidden name="'.$k.'" value="'.$v.'">'; [/code] but you would need to resubmit that form...
  6. personally... if it were me, i like functions... i'd do it this way.... [code] function get_itemname($id){ if(!isset($allitemnames[$id])){   $result=mysql_query("SELECT * FROM items WHERE `id`='$id' LIMIT 1");   $row=mysql_fetch_array($result);   $allitemnames[$id]=$row[name]; } return $allitemnames[$id]; } [/code] then wherever you want an item name... just... [code] echo get_itemname(1); echo get_itemname($page-1); echo get_itemname($page+1); [/code] or to that effect :-)
  7. theres lots of tutorials about pagination here :-) not tested... but should work... [code] $topallowed=10; if(empty($_GET[page])) $topfile=0; else $topfile=$_GET[page]; $topallowed=$topallowed+$page; $result=mysql_query("SELECT * FROM table LIMIT $topfile, $topalllowed"); while($row=mysql_fetch_array($result)){ } echo '<a href="?page='.$page-1.'">prev</a>'; echo '<a href="?page='.$page+1.'">next</a>'; [/code] just for ideas...
  8. yup! full url: [code] <? function get_url(){ if(!empty($_SERVER[QUERY_STRING])) return 'http://'.$_SERVER[SERVER_NAME].$_SERVER[PHP_SELF].'?'.$_SERVER[QUERY_STRING]; else return 'http://'.$_SERVER[SERVER_NAME].$_SERVER[PHP_SELF]; } echo get_url(); ?> [/code] just page: [code] <? echo $_SERVER['PHP_SELF']; ?> [/code]
  9. it is not necessary... after a submit, $_POST is an array of all the values that were submited, nothing more... but if you want only values that are filled in... [code] <?php session_start();  foreach($_POST as $key => $var) if(!empty($_POST[$key])) $_SESSION[$key] = $var; ?> [/code]
  10. true... isset() will check if the form was submitted, but !empty() is a much safer way of checking to see if a field has value...
  11. yes... with forms, when you press submit, it sends every field as $_POST, as is, isset() will always return true, you'd want to use !empty()...
  12. this is because of either a) flash is recording vector based art (php doesnt) b) flash works on a different color spectrom (hex, not rgb) or c) .jpg isnt translating the colours properly, try using .png(has more colour supports)
  13. yup... you can do it that way too if you want... but it if you were wanting your page more automated... you'd prolly want somin like this.... [code] <? function form_autodropbox($to=array(),$selected="",$name=""){ if(!is_array($to)) return FALSE; $return .= '<select name="'.$name.'">'; foreach($to as $k => $v){   if($k==$selected) $return .= '<option selected value="'.$v.'">'.ucwords($k).'</option>';   else $return .= '<option value="'.$v.'">'.ucwords($k).'</option>'; } $return .= '</select>'; return $return; } $to[test]="asdf"; $to[test2]="asdf"; $to[test3]="asdf"; $to[test4]="asdf"; echo form_autodropbox($to,"test3",'test') ?> [/code]
  14. taith

    overflow

    ... :-( i wants it to work on a table... but i dont see that happening :-( :'( it works on div's
  15. yup! just set a value to the fields... for example... [code]<input type=text value="<?=$_POST[test]?>" name="test">[/code]
  16. not tested, but should work :-) [code] <?php $now = getdate(time('G')); $hours = $now['hours']; $minutes = str_pad($now['minutes'], 2, "0", STR_PAD_LEFT);  $seconds = str_pad($now['seconds'], 2, "0", STR_PAD_LEFT);  echo $hours.":". $minutes.":".$seconds; ?> [/code]
  17. php runs before javascript... you set up the js using php, then the js can configure from there.
  18. .= just adds the string onto the end of a preexisting string [code] <? $str='hello'; $str.='world'; echo $str; #hello world ?> [/code]
  19. taith

    overflow

    still nothing.... [code] <style> .test{ height:200px; overflow:auto; width:10px; } </style> <table> <tr>   <td class=test><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>v</td> </tr> </table> [/code]
  20. include/require just crop the code from the target file, into the parent file. it doesnt make an iframe, you would need to do that seperatly.
  21. [code]<? function form_autodropbox($to=array(),$selected="",$name=""){ if(!is_array($to)) return FALSE; $return .= '<select name="'.$name.'">'; foreach($to as $k => $v){   if($k==$selected) $return .= '<option selected value="'.$v.'">'.ucwords($k).'</option>';   else $return .= '<option value="'.$v.'">'.ucwords($k).'</option>'; } $return .= '</select>'; return $return; } echo form_autodropbox($to,$_POST[name],"name") ?>[/code]
  22. the mysql_num_rows() shows you how many rows it returned... [code] $result = mysql_query("SELECT count(color) FROM mydb GROUP BY color AND catagory"); $row = mysql_fetch_array($result); print_r($row); #depends on your database which field they'll go into  :-) [/code]
  23. the reason why that happens... is because the picture background itself isnt exactly white, open it in gimp, color find, you'll find they are different colours... most likely.
  24. yes, include/require basically just "crop" the included page's source, into the parent file...
  25. taith

    overflow

    anyone wanna take a stab at why my overflow:auto never works? for example... [code] <style> .test{ height:300px; overflow:auto; } </style> <table> <tr>   <td class=test><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>x</td> </tr> </table> [/code] and i... get no overflow... just me usual table :-( ???
×
×
  • 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.