MySQL issue


Posted on 16th Feb 2014 07:03 pm by admin

I am taking sentences through a form on page. Then checking some condition and trying to insert them in database. I have issues while inserting...

foreach ($sentences as $final) {
......
Did you know?Explore Trending and Topic pages for more stories like this.
else {
if(strlen($final) <= 120){
echo $final.'.<br />';}
else
echo substr($final,0,120). '.<br />';

//Inserting of final(sentences) in database starts
$sent = mysql_real_escape_string($_POST ['$final']);
$error= "Error while inserting, either User present or other. Please check database";
$inserted= "sentences inserted";
$result = mysql_query("SELECT sent FROM sentences WHERE sent='{$final}' ");
if($result)
{
$num = mysql_num_rows( $result );
if ($num == 0) {
$querypost = mysql_query ("INSERT INTO sentences (sent) VALUES ('$final')");
echo $inserted;
}
else echo $error;
}
}
}

Please correct my logic error.
No comments posted yet

Your Answer:

Login to answer
103 Like 42 Dislike
Previous forums Next forums
Other forums

Converting from one format to another
"I have got a date in DD/MM/YYYY but I need it in MM-DD-YYYY. Help!"

mod_rewrite.c on windows ??
why it's not working on windows while it's working on other hosts???

this is the code i got

UTL File problem
Hi
I have a file in certain path with the following permissions (The file is a dummy file witho

Is there a function ... auto send IP
Is there some function that can be sent to a ddns service that returns the ip address of a ddns forw

ereg_replace in Wordpress
Heya - so I'm working on this site: http://world-of-smiles.theportlandco.com/new-patients

The

Switch letters in message (basic cryptology)...
I am trying to switch letters around in a message for an application on my site (see here). The prob

Must be a string? Huh, what? HELP?
with the following script, I get
Fatal error: Property name must be a string in /home/content/e/

user administration
Dear @all,

what I have to do to set the user defaults for new users. At the moment I woul

problem with php server update from mid 2009
Hi,

I have this navigation menu on 2 websites which used to work just fine. After a recent up

What exactly is net neatrality?
What exactly is it? I think it's anti-censorship and... stuff... but I don't really understand it

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash