PHP - Moved: Find Substring With Unknown Character? ( Test_x_here)
This topic has been moved to PHP Regex.
http://www.phpfreaks.com/forums/index.php?topic=321386.0 Similar TutorialsHello, I am trying to find a character in my DB's. The DB has the data setup with +(number) & -(number) I want to try and find a way for PHP to seperate them into two so each one has the seperate colour's. i have tried preg_match, strstr & strpos but none of them seem to work. Can you as PHP Genius's help out? EDIT: Please Do Not Worry, I have fixed this. For people who were wondering: $new_variable = strstr($variable_to_check, "+"); if($new_variable == "") { do one you want } else { do what you want. } Thanks PHP Freaks Thanks, NoMansLand How can I check this string to see if it has a ~ character using php? Code: [Select] $string = 'userlocation~credentials~specialties'; This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=308768.0 Hey, So what im trying to do is put my database variables into a session array. So this is what im trying to accomplish... $_SESSION['Name_of_Row'] = $value This is the script I wrote: Code: [Select] Function setupSession(){ session_start(); $query = "SELECT * FROM users WHERE u_id ='{$this->u_id}'"; $result = mysql_query($query); $row = mysql_fetch_array($result); foreach($row as $key => $value){ if(!empty($value)){ $_SESSION[$key] = $value; } } } When that runs I get the following warning. Can anyone tell me what this means and how to fix it? Error: Notice: Unknown: Skipping numeric key 0 in Unknown on line 0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=342991.0 This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=316294.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=306039.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=328966.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=350064.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=311598.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=312600.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=315388.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=343372.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=306874.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=350034.0 So I have a database with a bunch of dates in it. In this format 05/15/2011. And this is how I get that out. $data = mysql_query("SELECT * FROM location ORDER BY id ASC") or die(mysql_error()); while($info = mysql_fetch_array( $data )) { $date = $info['date']; }; echo "$date"; The resulted echo would be 05/26/2011 How do I get $date to echo out JUST 05? I'm trying to isolate the month. I think the method is using substrings, but I havent had any luck. Thanks any help would be great! Folks, I want to extract something from a URL, i think we need to use regex for this. Example URL: Code: [Select] http://www.amazon.co.uk/gp/aw/d/B004JN01LW/ref=mp_s_a_1?qid=1305169492&sr=8-1 What we need to Extract: So we need to extract B004JN01LW from the URL. I tried to use substr() but i think its not useful for this purpose, can someone help me with Regex to extract this? Cheers Natasha I am using tinyMCE editor and uploading image from it.After form is submitted,it makes textarea's values as <img width="\"65\"" height="\"66\"" alt="\\"" src="\"images/logo.gif\""> cuz of wrong html,it is not displaying image.I tried to replace $_POST['elm2'] = str_replace('"\"','\"',$_POST['elm2']); $_POST['elm2'] = str_replace('\""','\"',$_POST['elm2']); but it is not replacing.How can i correct the HTML so that i display image. Hi, how do I extract a substring? I just want to store "car" in a variable for other uses: Here is the original string: car/red/blue/gun/hit Any help much appreciated! Hello, Does anyone know how to get a substrig by referencing other substrings around it? Ie, my string is the following: These are my favorite foods: <ul> <li id="1"> Pizza </li> <li id="2"> Burgers </li> <li id="three"> Hot Dogs </li> </ul> I need to get the ID of each list item, i know they will always follow "<li id=". I also need to get the text of each list item, i know they will always be before "</li>" Thanks! |