$query = "INSERT INTO 'user-profiles' ('name', 'avatar', 'description', 'votes', 'pay_methods', 'location', 'user_id')
VALUES ('sadj', 'qwesad', 'sadqwdqw', '0','sadsad', 'sadasdsad''4')";

$resultprof = $this -> conn -> query($query);

votes and user_id are INT columns, and user_id is a foreign key.

Making this insert on mySQL directly it works perfectly, but on my PHP the "success" is false....

Recommended Answers

Are you sure you don't want 'sadasdsad','4' instead of 'sadasdsad''4'?

Jump to Post

Does just this specific query fail? Perhaps there is something wrong with the connection?

Jump to Post

All 5 Replies

Are you sure you don't want 'sadasdsad','4' instead of 'sadasdsad''4'?

commented: yeah, it's like that on the code but still failing +0

Does just this specific query fail? Perhaps there is something wrong with the connection?

commented: nop, all the other queries are working good ( i cant edit the topic, idk why, on my php code its 'sadasdsa', '4') +0

$query = "INSERT INTO 'user-profiles' ('name', 'avatar', 'description', 'votes', 'pay_methods', 'location', 'user_id')
VALUES ('sadj', 'qwesad', 'sadqwdqw', '0','sadsad', 'sadasdsad''4')";

$query = "INSERT INTO 'user-profiles' ('name', 'avatar', 'description', 'votes', 'pay_methods', 'location', 'user_id')
VALUES ('sadj', 'qwesad', 'sadqwdqw', '0', 'sadsad', 'sadasdsad', '4')";

Try above query

The OP replied by PM (a no no) that he had mistyped the table name.

$query = "INSERT INTO 'user-profiles' ('name', 'avatar', 'description', 'votes', 'pay_methods', 'location', 'user_id')
VALUES ('sadj', 'qwesad', 'sadqwdqw', '0','sadsad', 'sadasdsad','4')";

$resultprof = $this -> conn -> query($query);