0

I throw the exact same sql statement in phpmyadmin and it works but it does not work with mysql_query.

Ideas?

$a = "INSERT INTO players (player_id, first_name, last_name, date_of_birth, email, mobile_number, emergency_number, mother_name, father_name, player_number, team_captain, ip_address) VALUES ('', '', '', '', '', '', '', '', '', '', '', '127.0.0.1')"
$q = mysql_query($a);
4
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by OmniX
0

please check (or post here) with the database's table structure too,
the player_id should have been as 'not null'.
put the below code your line 2 -

echo "=>".mysql_error();

and post the output of echo here.

0

I throw the exact same sql statement in phpmyadmin and it works but it does not work with mysql_query.

Ideas?

$a = "INSERT INTO players (player_id, first_name, last_name, date_of_birth, email, mobile_number, emergency_number, mother_name, father_name, player_number, team_captain, ip_address) VALUES ('', '', '', '', '', '', '', '', '', '', '', '127.0.0.1')"
$q = mysql_query($a);

May be your player_id is the primary key that's why it is not inserting. primary key should not be null. Check your table structure.

0

hi
mabye there is some filed dosent accept null filed

check it , and print mysql_error($query);

0

Dont know what I did but I solved it... lol
I think I just reconstructed the sql query a different way to give me the same output and it worked.

PS: isnt "" not a NULL but a defined value?
PPS: it wouldnt matter in this case as the PK has AI attached?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.