Page 1 of 1

hello i am new here and i have a problem in mysql

Posted: Fri May 23, 2008 6:06 am
by mgtm3
hello every one
i have been programing php for 1 month and i realy like ut.
its the most wonderfull thing i have ever learned.

now i have a problem i am tring to insert into a mysql database a huge text like 400 words but there is a peoplem with it that when i try doing this it dose not let me.
but it dose not say that there is a problem it just dose not go into the database its like the code is not there like it jumps above it with out doing it.
the code that i am using is

$f = "INSERT INTO subjects (start) VALUES ('$text')";



$ss = mysqli_query($link,$f);

and when i try short text the code works fine

please tell me whats wrong????

Re: hello i am new here and i have a problem in mysql

Posted: Fri May 23, 2008 6:37 am
by onion2k
What are you using to display any errors?

Re: hello i am new here and i have a problem in mysql

Posted: Fri May 23, 2008 6:50 am
by mgtm3
die(mysql_error());;

and

error_reporting(E_ALL);

Re: hello i am new here and i have a problem in mysql

Posted: Fri May 23, 2008 8:06 am
by onion2k
mysql_error() won't work if you've connected with mysqli_connect().

Re: hello i am new here and i have a problem in mysql

Posted: Fri May 23, 2008 12:21 pm
by mgtm3
so how should i do it
?

Re: hello i am new here and i have a problem in mysql

Posted: Fri May 23, 2008 12:35 pm
by mgtm3
o.k i changed it to mysqli_error now it gives me
Warning: mysqli_error() expects exactly 1 parameter, 0 given in C:\wamp\www\tests\add1.php on line 22

but my parmters are set and they are not 0
whats the problem?

Re: hello i am new here and i have a problem in mysql

Posted: Fri May 23, 2008 2:04 pm
by mgtm3
o.k this is what i get i think i did the mysqli_error right now

Code: Select all

$f = "INSERT INTO subjects (sub,link,start,photo,idea,dir,postion) VALUES ('$sub','$url','$text','$photo','$idea','dir','postion')";
 
 
 
if (!mysqli_query($link, $f)) 
    printf("Errormessage: %s\n", mysqli_error($link));

7Errormessage: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's more than the 1,435 pence per share offer by Candover and Goldman Sachs Group ' at line 1

Re: hello i am new here and i have a problem in mysql

Posted: Sat May 24, 2008 2:29 pm
by onion2k
You aren't escaping the input. Use mysqli_real_escape_string().