Jump to content

mikesta707

Staff Alumni
  • Posts

    2,965
  • Joined

  • Last visited

Everything posted by mikesta707

  1. how would you normally style an html table? something like <table class="tableStyle"> or <table style="background-color:black" > wherever your table is, add the style text in there. If your table is being created in the php, then you have to set the styles in the php. For example, if I wanted to change the following table $table = '<table><td>Cell</td></table>'; to have a black background, and white font color, I could do $table = '<table style="background-color:black; font-color: white"><td>Cell</td></table>';
  2. I love Dreamweaver, and have been using it for a while. NetBeans was really slow when I tried to use it, but I was developing Java applications in it so IDK how well it does with PHP. I like eclipse instead of Netbeans for Java stuff anyways, and Komodo is pretty cool. NP++ is all around good though, and what I use when I don't have a dedicated IDE for a certain language
  3. just so you know newb, your example will work for file names with the character # anywhere, rather than strictly at the top $files = array("#file1", "file2", "file3", "fil#", "#file5"); foreach($files as $files) { $files = basename($files); if(preg_match('/#/', $files)) { echo ''.$files.'<br/>'; } } output: #file1 fil# #file5 you probably meant foreach($files as $files) { $files = basename($files); if (preg_match('/^[#]/', $files)){ echo ''.$files.'<br/>'; } } the ^ part matches to the beginning of the string
  4. Put your code in code tags please. if you want to add styles to something, do it like you would normally <input type="text" class="myStyle" /> or use the inline style attribute <input type="text" style="background-color: black" />
  5. What do yo umean unlimit the amount of items on the array? How are they limited? you can remove elements from an array like so <?php $arr = array(); for ($i = 0; $i < 10; $i++){ $arr[] = $i; } $key = array_keys($arr, 3);//gets an array of the keys with the value of 0 unset($arr[$key[0]]);//this will unset the first entry in the array with the value we searched for print_r($arr); ?> This outputs Array ( [0] => 0 [1] => 1 [2] => 2 [4] => 4 [5] => 5 [6] => 6 [7] => 7 [8] => 8 [9] => 9 )
  6. Well, since you MD5 the value of the timestamp, it becomes meaningless. If you didn't md5 it you could set up a CRON to get all the file names, extract the number (time()) and order them. then you could delete the bottom 3/5/7 or however many. Alternatively you can just delete the old file when you create a new file, or put them in some sort of archive. Whether or not it will become a problem depends on how often you update the file, and how big the files are
  7. This probably has more to do with CSS/HTML than PHP. have you validated your website? Without seeing any code, I can't offer much help though
  8. Can I see your form?
  9. Please note you can only use the quantifier with static functions and attributes. the following would not work class foo { public function bar() {} } foo::bar();//throws an error
  10. yes, that code is correct actually. all mysql_escape_string() does is escape characters that are special in mysql. for example, the ' character is commonly used in sql injections that don't escape it. add_slashes() does a similar thing, but its best to used the functions that were made specially for the database (for example mysql_escape_string() for mysql or pg_escape_string() for postgresql) magic_quotes_gpc() is a setting in php.ini that, when set to on, automatically escapes all POST and GET data (using addslashes()) this can cause problems when you use mysql_escape_string() or other escaping functions because you can end up double escaping things. Strip slashes would undo whatever magic_quotes_gpc() does, and you can then apply the arguably better mysql_escape_string() function (if you have a mysql database) to your string. it would be something like so //magic quotes gpc ON $data = $_POST['data'];//already escapes $data = stripslashes($data);//undid escape; $data = mysql_real_escape_string($data);//better escape //do whatever However, when you have magic quotes gpc set to off, you can simply do what you did in your example
  11. You can use a combination of mod rewrite and wild card sub domains. check out this tutorial clicky
  12. Do you know anything about the HTML DOM that Javascript has? Check out this tutorial. Pay special attention to getElementById(), and the .innerHTML attribute of tags. If you need extra help your best bet would be to post in the javascript section
  13. You could get the current url like so $url = "http://" . $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; echo $url; Example output: http://localhost/test2.php
  14. some of the functions are... ok.. i guess. but functions like this function db_getrow($result) { $getrow = mysql_fetch_row($result); return $getrow; } is just pointless.. they could have even just done this function db_getrow($result) { return mysql_fetch_row($result); } which really shows you how pointless it is. Oh well, no loss
  15. is there a problem or is this just about how crappy that code is? if its the latter, than yes I do agree
  16. if you want to write the line before the line of index x, then just do fwrite($rex[$x-1]);
  17. Oh, yeah it would appear you just need to change your queries, and the pagination would work the same
  18. uh sort of yes. I don't know what you mean by copy the code from your form, but in your new form you need to add some code to pull the data from your table, and populate the forms with that data
  19. well assuming your pagination works, if if you change the way the query works, then the pagination should still work (assuming it sends the same type of data) I would have to see some code before I gave a definite answer tho
  20. well whatever data you want, just use a query. if I wanted to get the columns col1, col2, and col3 from the row where the id was 5, i would do $query = "SELECT col1, col2, col3 from table WHERE id=5"; $sql = mysql_query($query); $row = mysql_fetch_assoc($sql); //now I can access the values like so $row['col1'];//column 1 $row['col2'];//col2 //etc.
  21. you disable a text box like so <input type="text" disabled="disabled" /> you can set the value of a text box like so <input type="text" value="<?php echo $myPHPValue; ?>" /> if you submit the form to the page where you want to show the disabled form, all you have to do is set the value to the corresponding post variables. if you submit them to a database, then you will have to pull the values from the database, and fill out the form
  22. this is the search tutorial: http://www.phpfreaks.com/tutorial/simple-sql-search the query I wrote above is more or less how you could get all the info from the db with whatever column starting with whatever letter. if you don't understand that than I suggest you read up on some mysql tutorials
  23. you should use the like keyword, like so $sql = "SELECT ..... WHERE column LIKE '$letter%' ... "; The key is the LIKE. LIKE searches for anything that is... well.. Like the variable $letter. the % tells mysql to match any words that start with $letter. it would be similar to the regex patter /^A/ which would match anything that starts with an A
  24. you can set the max script run time in your php.ini if you have access to it
  25. if you want the check boxes to be treated as an array, you need to signify to HTML that it is an array. so instead of the name attribute being name="Attendee" you need to set the name attribute to be name="Attendee[]". you access it normally (IE $_POST['Attendee'] but its an array now, instead of a single value
×
×
  • 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.