Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

About wildteen88

  • Birthday 02/21/1988

Profile Information

  • Gender
    Male
  • Location
    UK, Bournemouth

wildteen88's Achievements

Regular Member

Regular Member (3/5)

3

Reputation

  1. So $a will contain the id of a div you want to get, for example when $a is set to info only select the div with the id of info. In that case you can do this. $a = 'info'; preg_match_all('#<div id="' . $a . '">(.*?)</div>#sim', $page_all, $div_array);
  2. What is col10value1 and col10value2. Not sure what you're trying to do.
  3. You should read up on variable scope. Functions have their own variable scope meaning variables defined outside of them cannot be used within them. When using variables with functions you should be passing them as arguments. eg function myFunc($myVar) { echo $myVar; } $myVar = 'something'; myFunc($myVar); // pass $myVar to the function
  4. Use $div_array[1][0] instead maybe.
  5. To have that result you only need a few lines of code $resultSet = array(); while($row = mysql_fetch_assoc($query)) { $resultSet[] = $row; } echo "<pre>".print_r($resultSet,true)."</pre>";
  6. The function preg_match_all() is returning an array of matches. print_r() will output the contents of an array. If all you want is the text within the div tags then just echo out the variable $div_array[1] rather than using print_r. <textarea cols="50" rows="10"><?php echo $div_array[1];?></textarea>
  7. you can use substr, for example to only show the first 100 characters use echo substr($row["description"], 0, 100);
  8. You're not calling the function correctly $postje = $rows['post']; bbcode_format($postje); . It needs to be $postje = bbcode_format($rows['post']); Please read the document on the use of functions here http://php.net/manual/en/language.functions.php
  9. At the moment it sounds like you're not sanitizing your users input. Failing to to do this will make your script prone to SQL Injection attacks. To help prevent this you should use mysql_real_escape_string at minimum. Allowing users to post HTML in your guestbook doesn't sound like a good idea either. If you're going to allow HTML to be posted you should limit them to certain HTML tags such as <b>, <i>, <u> etc. You can implement this using strip_tags. The alternative is to use BBCode tags such as [, , and etc. There are many tutorials on the net making your own BBCode Parser.
  10. Its because Apache sees /logout/ and /logout as two completely different matches. To match regardless of the trailing slash use RewriteRule logout/? index.php?method=logout To use mod rewrite affectively you should read up on regular expressions.
  11. You need to check if the form has been submitted before running your query. The only way to see if a form has been submitted is to see if the $_POST vars exists. Like so if(isset($_POST['submit'])) { $rnamez = mysql_real_escape_string($_POST['ranchname']); $update = mysql_query("UPDATE players SET ranchname = '$rnamez' WHERE id = '".$_SESSION['id']."'"); }
  12. whats wrong with it?? As was said earlier it is not PHP code. That whats wrong. Why you post this code?. You are not making any sense.
  13. pfft.. i think i know what im talking about ive been programming in php for over 9 months now.. 9monts is nothing. Correct PHP syntax is like <?php $var = 'some value'; echo $var; call_some_function_here(); ?> What you posted is not event close to PHP. What! As in Apple Mac OSX? That is not even PHP thats a computer operating system.
  14. That code doesn't event represent PHP at all. What are you trying to do?
×
×
  • 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.