Jump to content

Search the Community

Showing results for tags 'string'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (Dreamweaver, Zend, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 14 results

  1. I have a DB of data: article-id, section-id, subsection-id, article-text. When a row is fetched I am displaying article, section, subsection as <h3>, <h4>, <h5> and then text in a <p>. Before outputting the text I want to scan it for other articles, sections, or subsections it may reference then turn that reference into a hyperlink. I read the PHP documentation but I can't find anything that translates to the basic commands of instring, indexof, and left/mid/right. Example: 1. Article Name 100. Article 1, section 1 100.a article 1, section 1, subsection a Text blah blah blah 105.f blah blah blah I want to find that 105.f and turn it into a link. All my articles, sections, and subsections are in the DB so I know I can use an array of the number values as my items to look for, but I can't figure out how to look.
  2. I am using AJAX to send an array of values to a PHP page that will insert the data into MySQL database. For some reason only the last 5 values are inserted into the MySQL database and I am woundering how to fix that. I am using foreach loop. AJAX Request: Array: [".testimonial", 1119, 316, 1663, 608, "#header", 723, 66, 1663, 608] Posting the array: Sending Array Parameters using " ; " to split. clicks .testimonial;1119;316;1663;608;#header;723;66;1663;608 Source Sent: clicks=.testimonial%3B1119%3B316%3B1663%3B608%3B%23header%3B723%3B66%3B1663%3B608 PHP Page <?php $clicks = $_GET["clicks"]; $clickArray = explode(";",$clicks); $arrays = array_chunk($clickArray, 5); $servername = "localhost"; $username = "root"; $password = "password"; $dbname = "clickmap"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $keys = array('postIdentifier', 'postPos_x', 'postPos_y','postWindowWidth','postWindowHeight'); foreach ($arrays as $array_num => $array) { $values = array(); foreach ($array as $item_num => $item) { $values[] = $item; } $data = array_combine($keys, $values); extract($data); // now your variables are declared with the right values http://php.net/manual/en/function.extract.php $sql = "INSERT INTO data (user_id, identifier_name, pos_x, pos_y, window_width, window_height, status) VALUES ('1', '$postIdentifier', '$postPos_x', '$postPos_y','$postWindowWidth','$postWindowHeight', 'ok')"; } if ($conn->query($sql) === TRUE) { echo "New record created successfully"; } else { echo "Error: " . $sql . "<br>" . $conn->error; } $conn->close(); ?> Is this the correct way of coding it, and why does it post only the last 5 values? Any help would be much appreciated!
  3. i need to change the color of a word in a string where the word is unknown (from $_POST) and may have one or more uppercase chars. code please.
  4. Hey friends, I just started learning php. I want to know the difference between == and === I exactly want to know the comment section of the given code below. Thanks. <?php $mystring = 'abc'; $findme = 'a'; $pos = strpos($mystring, $findme); // The !== operator can also be used. Using != would not work as expected // because the position of 'a' is 0. The statement (0 != false) evaluates // to false. if ($pos !== false) { echo "The string '$findme' was found in the string '$mystring'"; echo " and exists at position $pos"; } else { echo "The string '$findme' was not found in the string '$mystring'"; } ?>
  5. Hi I have a MySql database and wondered if there is a code to search a table field with a given string and display the number of unique occurrences. The table is asterisk_cdr and would like to know how many calls received daily on a perticular channel. Thanks shmideo
  6. Hi Community! :-) (Sorry for my average english) I recently started coding in php, till now, i allready have advanced skills in programming with C# and thus, had no problems writing my own script. Still, my script does not really work, i'm trying to check if a file contains a md5(string), but the script never finds the string. This is the script: (please don't mind any security issues, this is just a test. But if you have any tips and tricks to improve the security, i'd be glad to receive them) <?php $webname = $_POST["webname"]; $webcode = $_POST["webcode"]; $webpass = $_POST["webpass"]; if (file_exists("web/". $webname . ".html")) { $file = file_get_contents("web/". $webname . ".html", "r"); if (strpos(md5($webpass),$file) !== false) { $usergen = fopen("web/" . $webname . ".html", "w") or die("Unable to open file!"); fwrite($usergen, $webcode); fwrite($usergen, "<!--- ". md5($webpass) . "--->"); fclose($usergen); echo "Generated! You can view your site under /web/" . $webname . ".html"; } else { echo "The file already exists but you entered the wrong Password.<br> Pressing the \"return\" Button will bring you back without loosing the code you entered."; } } else { $usergen = fopen("web/" . $webname . ".html", "w") or die("Unable to open file!"); fwrite($usergen, $webcode); fwrite($usergen, "<br><!--- ". md5($webpass) . " --->"); fclose($usergen); echo "Generated! You can view your site under /web/" . $webname . ".html"; } echo "<FORM><INPUT Type=\"button\" VALUE=\"Back\" onClick=\"history.go(-1);return true;\"></FORM>"; ?> What it does it pretty simple, you enter some html-code that'll be stored in the "webcode" variable, a password, let's say "apple" in "webpass" and the filename is stored in "webname". On first creation, a html-file is created with the <!--- md5(apple) ---> at it's end, the HTML Tags are needed to hide the string from any visitors. If someone wants to edit the File created before, he also enters "apple". Then the string will be looked up as md5(apple) in the file. If the strings match, it's true and the changes should be saved. Whatever i do, though, i'm allways ending up here if i try to edit an existing file: "The file already exists but you entered the wrong Password.<br> Pressing the \"return\" Button will bring you back without loosing the code you entered."; As i said, i'm a newbie, i'd appreciate any tips and help. Thank you in advance!
  7. Say I have a form field where I input any text(numbers,text,symbols, or mixed). I want to encrypt that input into 16 characters long encryption string that includes at least one uppercase letter, one lowercase letter, one number and one special character? How can that be done? Also I want to decrypt it back to original input as well. Can that be one?
  8. Hello. Just a quick question about using a loop to create a string from post variables that will then be used in a query. I have several post variables submitted in a form, some of which contain a value of T. Others are not selected. In the database there are several columns which may contain values of T or may not. I would like to construct a query that searches for specific columns containing T and ignoring the rest. I'm using WHERE "T" IN(colnames). I need to get the column names into a comma separated string. Here's what I'm using: $postVal = array("1", "2", "3", "4", "5"); foreach ($postVal as $key=>$val){ $newVar = “col”.$val; if ($$newVar == "T") { *create/add to comma-separated string } else { *ignore } } I hope that seems clear enough. I'm just not sure if I'm on the right track or not. What do you think? Thank you, in advance!
  9. Below I have "Input" where it shows the original string. Basically I want to remove everything before " - ". I would like to know how can I get the "Output" results using PHP? Input $variable_1 = Lulu-free - Swimsuit swimwear red $variable_2 = Pap & Jones - Bard Mini Dress Output $variable_1 = Swimsuit swimwear red $Variable_2 = Bard Mini Dress
  10. Hi dear php coders! ]'m almost new in php and now i'm dealing with wordpress . ] want to get a long string from database with get_post_meta function. (and aftar that i wanna Parse this string and Play with that ...! ) how can i do that ?? i don't know what arguments i must pass to the function ... any help would be appreciated. thanks in advance.
  11. I have a string e.g. products.0.name and I want to change the string to; products[0][name] I have come up with some code that works but is a bit of a hack, my code is below; var array = field.split("."); field = array[0]+'['+array[1]+']['+array[2]+']'; Is there a better way, I am sure there is using regex? Thanks
  12. I'm going to create a web page with <iframe> tag & want that the src of <iframe> change as value of url in query string changes.i.e. mysite.com/?url=google.com then,src of <iframe> should google.com
  13. Hello guys! For every word in a sentence or phrase how do i make the first letter for each word a capital letter. Expecting your response Thanks guys!
  14. Hello. I have a problem when I send an article to DB from the server (in localhost everything is working fine). So, the news_post (textarea) is sending backslashes before single and double quotes, broking embed elements (images, videos, etc.). The articles are sent to DB throught this coide:
  • 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.