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

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
mgtm3
Forum Newbie
Posts: 6
Joined: Fri May 23, 2008 5:59 am

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

Post 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????
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

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

Post by onion2k »

What are you using to display any errors?
mgtm3
Forum Newbie
Posts: 6
Joined: Fri May 23, 2008 5:59 am

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

Post by mgtm3 »

die(mysql_error());;

and

error_reporting(E_ALL);
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

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

Post by onion2k »

mysql_error() won't work if you've connected with mysqli_connect().
mgtm3
Forum Newbie
Posts: 6
Joined: Fri May 23, 2008 5:59 am

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

Post by mgtm3 »

so how should i do it
?
mgtm3
Forum Newbie
Posts: 6
Joined: Fri May 23, 2008 5:59 am

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

Post 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?
mgtm3
Forum Newbie
Posts: 6
Joined: Fri May 23, 2008 5:59 am

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

Post 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
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

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

Post by onion2k »

You aren't escaping the input. Use mysqli_real_escape_string().
Post Reply