matt82 Posted August 11, 2008 Share Posted August 11, 2008 Hi guys i am very new to php so any help would be much apreciated the code seems like it should work none of the built in errors are returned but when i look at my mysql db no new entries are added. <html> <head> </head> <body> <?php include 'library/config.php'; include 'library/opendb.php'; $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'w33kDays!'; $dbname = 'advendeals'; $connnection = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); return $connection; mysql_select_db($dbname); $query = "INSERT INTO clients (ClientID, ClientCountry, ClientState) VALUES ('176', 'Australia', 'queensland')"; mysql_query($query) or die('Error, insert query1 failed'); $query = "FLUSH PRIVILEGES"; mysql_query($query) or die('Error, insert query2 failed'); include 'library/closedb.php'; ?> </body> </html> thanks in advance for any help. Quote Link to comment https://forums.phpfreaks.com/topic/119229-insert-not-working/ Share on other sites More sharing options...
adam84 Posted August 13, 2008 Share Posted August 13, 2008 Why do you have 'return $connection'? Your code is stopping at the point. Remove that line and try it again. Quote Link to comment https://forums.phpfreaks.com/topic/119229-insert-not-working/#findComment-615688 Share on other sites More sharing options...
matt82 Posted August 15, 2008 Author Share Posted August 15, 2008 Thanks mate once i got past that i was able to get the code working. i appreciate it Quote Link to comment https://forums.phpfreaks.com/topic/119229-insert-not-working/#findComment-617036 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.