3d!T Posted January 30, 2007 Share Posted January 30, 2007 Hi! I'm quite the N00b round here, so be lenient...I'm working on a job listings page for a recruitemnt site. I've set up an SQL db with no problem, and can call SELECT statements to display the data on my PHP page. I'm now working on a back end content management bit for the dorks who work here to update the jobs themselves. So I've been binding the form fields to the SQL fields and all seemed well - except it will not insert the data into the db... I've now broken down the page to literally just insert what I'm telling it to:[code]<?require("Connections/jobsdb.php");echo("Database connection successful.\n");$query = "INSERT INTO Current_Jobs VALUES ('', 'testing', 'fooooooooooobaaarrrrr', 'bidleybum', '2007-01-11', 'blah', CURDATE())";mysql_query($query);mysql_close();?>[/code]When I preview the page (on the server), it seems to run without error, but fails to add a new row of data. I have checked the SQL statement in the MySQL Query Browser, and it works. Can someone please tell me what planet I'm on? Link to comment https://forums.phpfreaks.com/topic/36317-solved-phpsql-frustration-im-probably-being-a-bit-thick/ Share on other sites More sharing options...
ted_chou12 Posted January 30, 2007 Share Posted January 30, 2007 you are on pluto (furtherest away from earth)"INSERT INTO userinfo(username, password) VALUES ('$username', '$password') "This is an eg. of query whick you do an insert, which looks quite different to yours...Ted Link to comment https://forums.phpfreaks.com/topic/36317-solved-phpsql-frustration-im-probably-being-a-bit-thick/#findComment-172670 Share on other sites More sharing options...
Cep Posted January 30, 2007 Share Posted January 30, 2007 You haven't stated in your sql the field names. Link to comment https://forums.phpfreaks.com/topic/36317-solved-phpsql-frustration-im-probably-being-a-bit-thick/#findComment-172671 Share on other sites More sharing options...
3d!T Posted January 30, 2007 Author Share Posted January 30, 2007 This is true... I was led to believe you don't actually have to qualify the SQL fields/userdata as long as the data matches the datatypes...(?) I'll give it a go - you're probably right... (but Pluto's not a planet).. Link to comment https://forums.phpfreaks.com/topic/36317-solved-phpsql-frustration-im-probably-being-a-bit-thick/#findComment-172672 Share on other sites More sharing options...
ted_chou12 Posted January 30, 2007 Share Posted January 30, 2007 yeah, thats just recently... Link to comment https://forums.phpfreaks.com/topic/36317-solved-phpsql-frustration-im-probably-being-a-bit-thick/#findComment-172676 Share on other sites More sharing options...
3d!T Posted January 30, 2007 Author Share Posted January 30, 2007 Ok solved... It seems I wasn't binding to the db correctly... thanks for your help folks. :-* Link to comment https://forums.phpfreaks.com/topic/36317-solved-phpsql-frustration-im-probably-being-a-bit-thick/#findComment-172680 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.