Jump to content


Staff Alumni
  • Posts

  • Joined

  • Last visited


Everything posted by wildteen88

  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?
  15. This is bad code practice. Post your queries here. I assume you're querying two different tables. MySQL is able to pull data from multiple tables within one query using JOINs.
  16. Oh.. I thought it was just some random code. What is the problem you are having?
  17. This code is not needed at all. Just remove it $result2 = mysql_query("SELECT * FROM inputs WHERE user_id = " . $userid); if(!$result2){ die("Error quering the Database: " . mysql_error());} $total_items = mysql_num_rows($result2); echo "Total Number of records in Database: " . $total_items; Everything else is fine. However the code could be tidied up a bit.
  18. EDIT CV got there first Umm. That is completely the wrong syntax. This is the correct syntax $cust_name = array(); foreach($CustomerList_result->getRecords() as $CustomerList_row) { $cust_name[] = $CustomerList_row->getField('d_company'); }
  19. [quote author=jackpf link=topic=54859.msg1176080#msg1176080 date=1241422904] I had a go with net beans...didn't care for it. I find it annoying the way it will autocomplete a quote for you, but it won't put the semicolon on the end. That means you just have to navigate around to append the semicolon. It probably would have been faster if I just typed the extra quote myself tbh. [/quote] Or just press the End key or right arrow key.
  20. Yes, however it only generates an $sql variable for passing to mysql_query and nothing else. For example is ran the following query in PMA: SELECT * FROM Table It'll only generate $sql = 'SELECT `*' . ' FROM table';
  21. You should have look into the concatenation operator to join strings. I'd change: echo '</center></td><td><center>'; echo '<a href="download.php?f='; echo $row[fname]; echo '">'; echo $row[fname]; echo '</a></center>'; to echo '</center></td><td><center><a href="download.php?f=' . $row['fname']} . '">' . $row['fname'] . '</a></center>';
  22. Yes you have installed XAMPP fine. You place all your files in /opt/lampp/htdocs for linux installations. Read here for locating other files/directories too. XAMPP has a redirection script (I thing its called index.html) located in /opt/lampp/htdocs which will redirect you to xampp/splash.php when you access http://localhost If you want you can remove this script (clear your browsers cache afterwards though). To run your script you go to http://localhost/scriptname.php
  23. You don't need to install an SMTP mail server locally to send emails. Just configure PHP to point to an existing SMTP mail server. To do this open your php.ini and locate the following lines: [mail function] ; For Win32 only. SMTP = localhost smtp_port = 25 ; For Win32 only. ;sendmail_from = me@example.com Change localhost to your ISP's mail server address, eg smtp.your_isp.com Leave the smtp_port as-is (change it if your ISP uses a different port). Next remove the semi-colon ( ; ) from in front of the sendmail_from line and change me@example.com to the email address provided by your ISP. Save the php.ini and restart Apache. Test to see if the changes worked by running a simple mail script.
  24. You cant from a remote location, you have to be at the computer to see its ip address. Just go to places like whois.com to get your computers ip address.
  • 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.