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);

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.

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.

hi
mabye there is some filed dosent accept null filed

check it , and print mysql_error($query);

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.