-
Posts
167 -
Joined
-
Last visited
Never
Everything posted by salman_ahad@yahoo.com
-
My code -------- <?php if ($_POST['Submit']) { $para = $_POST['para']; } $sentence = split('[.!?]',$para); foreach ($sentence as $final) { if (empty($final)) continue; else { $final = ltrim($final,'"'); $final = ltrim($final,','); $final = ltrim($final,'\"'); $final = ltrim($final,'S'); $final = ltrim($final,'.'); if(strlen($final) <= 120) echo $final.'.<br />'; else echo substr($final,0,120). '...Read More.<br />'; } } ?> I am trying to input a paragraph and split it into sentences. Some output sentences are proper and some are having errors Few output error sentences are starting like this -------------------------------------------- 1). //A sentence cannot start with a period 2)\"There are .... //A sentence cannot start with \"
-
CHECH A STRING FOR ' " ' (DOUBLE QUOTES)
salman_ahad@yahoo.com replied to salman_ahad@yahoo.com's topic in PHP Coding Help
It is not solved, but I am closing it. -
[SOLVED] Check before inserting in DB ???
salman_ahad@yahoo.com replied to salman_ahad@yahoo.com's topic in PHP Coding Help
Thanks. I made a little change and it worked. if ( $_POST ['Submit']) { $username = mysql_real_escape_string($_POST ['usernm']); $userpassword = mysql_real_escape_string($_POST ['userpw']); $error= "Error while inserting, either User present or other. Please check database"; $inserted= "User inserted"; $result = mysql_query("SELECT usernm FROM users WHERE usernm='{$username}' and userpw='{$userpassword}' "); if($result) { $num = mysql_num_rows( $result ); if ($num == 0) { $querypost = mysql_query ("INSERT INTO users (usernm, userpw) VALUES ('$username','$userpassword')"); echo $inserted; } else echo $error; } } ?> -
This is my code --------------- if ( $_POST ['Submit']) {{ $username = $_POST ['usernm']; $userpassword = $_POST ['userpw']; } /*insert data from the form into the db table*/ $querypost = mysql_query ("INSERT INTO users (usernm, userpw) VALUES ('$username','$userpassword')"); } ?> How do I check before inserting whether that username and password is already inserted. I have an id assigned to every entry.
-
Alternate messaging
salman_ahad@yahoo.com replied to salman_ahad@yahoo.com's topic in PHP Coding Help
Any startup idea would help me pick up..... -
[SOLVED] What is wrong in my query ??
salman_ahad@yahoo.com replied to salman_ahad@yahoo.com's topic in PHP Coding Help
Thanks Keith, I was using a different 'id'...I fixed it. -
[SOLVED] What is wrong in my query ??
salman_ahad@yahoo.com replied to salman_ahad@yahoo.com's topic in PHP Coding Help
Now I am getting Unknown column 'id' in 'order clause' error -
require_once("includes/connection.php"); $query = mysql_query("SELECT * FROM users ORDER BY id DESC"); $num_rows = mysql_num_rows($query); if ($num_rows < 1) { echo "No comments posted yet"; } else { while($row = mysql_fetch_array($query)) { $userid = $row['userid']; $username = $row['usernm']; $userpassword = $row['userpw']; echo "$userid"; echo "$username"; echo "$userpassword"; echo "<br \>"; } } My error --------- Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource. It has returned me empty but my database has data..What did I do wrong?
-
Alternate messaging
salman_ahad@yahoo.com replied to salman_ahad@yahoo.com's topic in PHP Coding Help
any help guys -
[SOLVED] greater than condition
salman_ahad@yahoo.com replied to salman_ahad@yahoo.com's topic in PHP Coding Help
Thanks -
CHECH A STRING FOR ' " ' (DOUBLE QUOTES)
salman_ahad@yahoo.com replied to salman_ahad@yahoo.com's topic in PHP Coding Help
Thanks @MadTechie Almost done ! this is my code -------------- preg_match_all('/(?<=")\s*(.*?)[.!?]\s*(?="|$)/sm', $para, $result, PREG_PATTERN_ORDER); $result = $result[1]; foreach ($result as $result2){ if (empty($result2)) continue; else { if (strlen($result2)<=115) echo $result2.'.<br />'; else echo substr($result2,0,115). '...Read More.<br />'; } } // Lets say I am accepting a big paragraph. But there are only 3 output sentences. How can we change just enough to output all the sentences...?? -
current condition ---------------- if (strlen($sentence)<=115) I need to change it to > 40 and <115 // How can I do it??
-
Alternate messaging
salman_ahad@yahoo.com replied to salman_ahad@yahoo.com's topic in PHP Coding Help
I have a db Table1 contains these String messages Table2 contains these Users I need to write a test.php where you can help me with code snippet. expected result --------------- string1 to user1 string2 to user2 string3 to user3 string4 to user1 string5 to user2 Now what should be my code in test.php to send these alternating users with the data I have in another table?? -
Alternate messaging
salman_ahad@yahoo.com replied to salman_ahad@yahoo.com's topic in PHP Coding Help
I can work on the database. But I need a code snippet which calls alternate functions. (Switches between functions) -
I have 4 strings in MySQL db1 $string1 : Hello $string2 : Hi $string3 : Great $string4 : Thanks And I have 3 accounts MySQL db2 $User1 : $Pw1 $User2 : $Pw2 $User3 : $Pw3 expected result --------------- Hello goes to user1 Hi goes to user2 Great goes to user3 // all the users have been sent a message, so iterator should go to user 1 again Thanks goes to user1 Any code snippet please....THANKS
-
I have a page www.mysite.com/test.php with a <form> <textarea name="data" cols="100" rows="20"></textarea> //to enter the page matter <input name="Link" type="submit" value="Link" /> //to enter the link </form> user input // which I submit in the form ---------- data: This is page matter which is shown on my page. link : page1.php expected result --------------- www.mysite.com/page1.php // THIS PAGE IS CREATED This is page matter which is shown on my page. // THIS SHOULD BE THE MATTER WITHIN THE PAGE //** It should get my default css from root** Any code snippet please, THANKS
-
[SOLVED] Run function every 5 mins ??
salman_ahad@yahoo.com replied to salman_ahad@yahoo.com's topic in PHP Coding Help
Yes.. it is there. Thanks !!! -
[SOLVED] Run function every 5 mins ??
salman_ahad@yahoo.com replied to salman_ahad@yahoo.com's topic in PHP Coding Help
I am on GoDaddy server. My files are on Linux Is there a cron job on godaddy? -
CHECH A STRING FOR ' " ' (DOUBLE QUOTES)
salman_ahad@yahoo.com replied to salman_ahad@yahoo.com's topic in PHP Coding Help
Respected MadTechie <?php $string = "These are our sentences." This is great. "You are the best!" You can do it.; preg_match_all('/" your expression/sm', $string, $result, PREG_PATTERN_ORDER); .... foreach ($result as $result2){ echo $result2. '<br \>'; } ?> my expected result: These are our sentences This is great You are the best You can do it I hope you could help me with this now. I cannot explain my question more clearer than this! -
I have a function PostMessage() How can I run it every 5 mins ??
-
[SOLVED] Concatenate two strings ???
salman_ahad@yahoo.com replied to salman_ahad@yahoo.com's topic in PHP Coding Help
Thanks guys... -
I have string one $string1 and another $string2. How to concatenate (add) both of them $string1+" "+$string2 also check condition for the total string length not more than 100 characters
-
[SOLVED] How to grab certain words ??
salman_ahad@yahoo.com replied to salman_ahad@yahoo.com's topic in PHP Coding Help
EXACTLY !! Thanks Dude -
[SOLVED] How to grab certain words ??
salman_ahad@yahoo.com replied to salman_ahad@yahoo.com's topic in PHP Coding Help
I got his error while running the code Warning: Invalid argument supplied for foreach() in foreach($branches as $entry) There are about 10 names there which keep changing, your code is only grabbing Halloween. If I run your code after four hours I will not know which are those 10 words. Please help -
[SOLVED] How to grab certain words ??
salman_ahad@yahoo.com replied to salman_ahad@yahoo.com's topic in PHP Coding Help
I think we are almost there. But we need to grab all the names as ['name']== "xxxx" (could be anything, not only Halloween) How to do this ?