Jump to content

ronverdonk

Members
  • Posts

    277
  • Joined

  • Last visited

    Never

About ronverdonk

  • Birthday 10/25/1943

Profile Information

  • Gender
    Male
  • Location
    Netherlands

ronverdonk's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. It is still not quite clear to me, but let's be practical: When you are looking form www.xxx.yy text that has to be converted into links, have a try at the following regular expression: <?php $pattern_url = '~(?>[a-z+]{2,}://|www\.)(?:[a-z0-9]+(?:\.[a-z0-9]+)?@)?(??:[a-z](?:[a-z0-9]|(?<!-)-)*[a-z0-9])(?:\.[a-z](?:[a-z0-9]|(?<!-)-)*[a-z0-9])+|(??:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(?:/[^\\/:?*"<>|\n]*[a-z0-9])*/?(?:\?[a-z0-9_.%]+(?:=[a-z0-9_.%:/+-]*)?(?:&[a-z0-9_.%]+(?:=[a-z0-9_.%:/+-]*)?)*)?(?:#[a-z0-9_%.]+)?~i'; $text = 'This is www.mysystem.com where the text can be found. Also at www.yourcom.nl you find some comments'; /** ----------------------------------------- Prefix www.xxxxx.yy string with http:// ----------------------------------------- */ preg_match_all($pattern_url, $text, $matches); for ($i=0; $i < count($matches[0]); $i++) { if (substr($matches[0][$i],0,4) == 'www.' ) $text = str_replace($matches[0][$i], 'http://'.$matches[0][$i], $text); } /** ---------------------------------------------------- Replace free-format URLs with <a href...> elements ---------------------------------------------------- */ $text = preg_replace($pattern_url,"<a href=\"\\0\">\\0</a>", $text); echo $text; ?>
  2. Something line: $a=array('id1','id2','id3','id4','id5','id6','id7','id8','id9','id10','id11','id12'); for ($i=0, $j=1; $i<count($a); $i+=2,$j+=2) { echo "<br>$a[$j]"; echo "<br>$a[$i]"; }
  3. In order to prevent possible 'undefined index' notices, you'd better code: $test = isset($_POST['carregistration']) ? $_POST['carregistration'] : null; etc
  4. Just do $_SESSION['lastid'] = mysql_insert_id();
  5. PHP manual: "setcookie() defines a cookie to be sent along with the rest of the HTTP headers. Like other headers, cookies must be sent before any output from your script (this is a protocol restriction). This requires that you place calls to this function prior to any output, including <html> and <head> tags as well as any whitespace. When the cookie is not set, a FALSE is returned." So I suggest that you check the result of setcookie() to check, as in: if (setcookie('uid', $row[0]['u_uid'], time() + $session_length) === false) {// this cookie isnt being set echo 'Setcookie failed'; exit; }
  6. To me you are switching the assignments, i.e. if (!isset($_POST['name'])) { $_POST['name'] = "name"; } should be if (!isset($_POST['name'])) { $name = $_POST['name']; } this goes for all the assignments from the $_POST array.
  7. Assuming you are talking about MySQL and "the ID generated for an AUTO_INCREMENT column by the previous query on success, 0 if the previous query does not generate an AUTO_INCREMENT value, or FALSE if no MySQL connection was established." (PHP manual) you can use the mysql_insert_id() function
  8. You have a webserver, XAMPP. That contains Apache, MySql, PHP and Perl. The webserver root is the root of your XAMPP installation, usually htdocs. Once you installed your clock in that root, you access it using the url localhost/progrname.php
  9. You are using single quotes there (witin a single quotes statement), so make the statement within double quotes: $query = mssql_query("SELECT Title, Surname, FirstName FROM PeoplesRec where Username = '$pnlusername' ");
  10. What format of links are we talking about: a. the a-tag link like <a href=xxxx>yyyyy</a> b. the url type such as http://www.mysite.com c. within bb-code such as [link=xxxxx]yyy[/link]
  11. I sure must be missing some code then: a. you specify no method, so the default method is GET b. you have no submit link or button, so it never gets submitted. All your code does now, as you have shown, is to show you some tables in a select box and the attributes of the last table in the select. So where is the submit button/link?
  12. Where do you submit the form? Btw: your form method is, by default, GET. So your $_POST will not work.
  13. Have you tried a regular expression (like preg_*) on your text data?
  14. So show us some of the code you have already made. I cannot guess!
×
×
  • 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.