anon Posted December 30, 2007 Share Posted December 30, 2007 Hi, i want to know how i can write a string called $page into a database table. file_put_contents ? Quote Link to comment https://forums.phpfreaks.com/topic/83708-writing-string-to-database/ Share on other sites More sharing options...
kenrbnsn Posted December 30, 2007 Share Posted December 30, 2007 No, that is for writing to files. It depends on what database engine you're using. We need more information from you. Ken Quote Link to comment https://forums.phpfreaks.com/topic/83708-writing-string-to-database/#findComment-425909 Share on other sites More sharing options...
anon Posted December 30, 2007 Author Share Posted December 30, 2007 I'm using myISAM with MySql. I have a database and I want to write the string to the database. so file_put_contents isn't suitable. Should I use a MySQL query? Quote Link to comment https://forums.phpfreaks.com/topic/83708-writing-string-to-database/#findComment-425913 Share on other sites More sharing options...
kenrbnsn Posted December 30, 2007 Share Posted December 30, 2007 You really need to learn how to use MySQL from PHP. http://www.php.net/manual/en/ref.mysql.php Ken Quote Link to comment https://forums.phpfreaks.com/topic/83708-writing-string-to-database/#findComment-425917 Share on other sites More sharing options...
MadTechie Posted December 30, 2007 Share Posted December 30, 2007 While i 101% agreee with kenrbnsn, i just think its worth adding the functions your need to use are Insert (to add a record and update to update an existing record(s), if this sounds confusing them your need to readup on it. Quote Link to comment https://forums.phpfreaks.com/topic/83708-writing-string-to-database/#findComment-425921 Share on other sites More sharing options...
anon Posted December 30, 2007 Author Share Posted December 30, 2007 So would i use mysql_query("insert into Index, values ($page)"); ? Quote Link to comment https://forums.phpfreaks.com/topic/83708-writing-string-to-database/#findComment-425934 Share on other sites More sharing options...
MadTechie Posted December 30, 2007 Share Posted December 30, 2007 No, 1. Index is a reserved word 2. No , needed Quote Link to comment https://forums.phpfreaks.com/topic/83708-writing-string-to-database/#findComment-425936 Share on other sites More sharing options...
anon Posted December 30, 2007 Author Share Posted December 30, 2007 Okay, i'll change the database. mysql_query("insert into *** values ($page)"); Quote Link to comment https://forums.phpfreaks.com/topic/83708-writing-string-to-database/#findComment-425950 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.