| | |
Insert Statement not working?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
I throw the exact same sql statement in phpmyadmin and it works but it does not work with mysql_query.
Ideas?
Ideas?
PHP Syntax (Toggle Plain Text)
$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);
"You never stop learning." - OmniX
•
•
Join Date: Sep 2009
Posts: 557
Reputation:
Solved Threads: 64
0
#2 Oct 6th, 2009
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 -
and post the output of echo here.
the player_id should have been as 'not null'.
put the below code your line 2 -
PHP Syntax (Toggle Plain Text)
echo "=>".mysql_error();
•
•
Join Date: Apr 2009
Posts: 5
Reputation:
Solved Threads: 1
0
#3 Oct 6th, 2009
•
•
•
•
I throw the exact same sql statement in phpmyadmin and it works but it does not work with mysql_query.
Ideas?
PHP Syntax (Toggle Plain Text)
$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);
0
#5 Oct 6th, 2009
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?
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?
"You never stop learning." - OmniX
![]() |
Similar Threads
- Problem with insert statement (ASP.NET)
- Insert statement problem in sql server 2005 (MS SQL)
- SQL Insert statement syntax (Visual Basic 4 / 5 / 6)
- insert statement problem (C#)
- Syntax error in INSERT INTO statement, please help (ASP)
- Syntax error in INSERT INTO statement (Java)
- insert statement error (MySQL)
- Its really a problem on INSERT statement (MySQL)
Other Threads in the PHP Forum
- Previous Thread: Interactive Timetable - Assign timeslots
- Next Thread: Email error - PHP
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date directory display download dynamic echo email encode error fcc file files folder form forms function functions google howtowriteathesis href htaccess html image images include insert integration ip java javascript joomla ldap limit link login loop mail menu mlm mod_rewrite multiple multipletables mysql oop open parse paypal pdf php problem provider query radio random recursion regex remote script search server sessions sms soap source space sql strip_tags structure syntax system table template tutorial update upload url validation validator variable video web xml youtube





