RetroSpock Posted May 16, 2013 Share Posted May 16, 2013 Hello all, I've created an auto-response script for work, which originally stored the auto-response script (the paragraph of text) in a php file that I would include into the actual form. I have decided to use MySQL to try and make it a little more flexible, however I'm wondering how I can use MySQL to pull the output script from Mysql. Right now, I have a table called output_scripts, a column called SID and another column called OutputScript. OutputScript contains the text that I want to generate (Hello, $name - your password is $password. Please proceed to log in to $url -- for example) and SID is auto incremented. Can I call SID to pull the text I need from OutputScript? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/278065-echo-a-string-by-unique-key/ Share on other sites More sharing options...
fenway Posted May 19, 2013 Share Posted May 19, 2013 Sure, you can query a database for a column value -- but I'm assuming your question is more complicated than that? Please elaborate. Quote Link to comment https://forums.phpfreaks.com/topic/278065-echo-a-string-by-unique-key/#findComment-1431022 Share on other sites More sharing options...
RetroSpock Posted May 20, 2013 Author Share Posted May 20, 2013 (edited) I've not touched MySQL in years so I'm basically coming back to it 'for the first time',I'm not enitrely sure what is I'm asking. What I need is to store a couple of paragraphs into MySQL, and echo that content by referrencing an ID because I want the content editable. I suppose the best way to explain what I mean is, let's assume it's a news article. I want to be able to store the article in MySQL, echo said article into a PHP script, allow the user to completely rewrite the article and still have it echo the edited column entry. Does that make sense? I'm struggling to put it into words lol. In Pseudo-code: Content goes into Column 1 Echo Column 1 User edits content that belongs to column 1 Echo Column 1 (which will be the edited content, not the original) Edited May 20, 2013 by RetroSpock Quote Link to comment https://forums.phpfreaks.com/topic/278065-echo-a-string-by-unique-key/#findComment-1431166 Share on other sites More sharing options...
Jessica Posted May 20, 2013 Share Posted May 20, 2013 (edited) here is a tutorial I wrote on CRUD - Create, Read, Update and Delete. http://thewebmason.com/php-mysql-crud-tutorial-using-pdo-create-read-update-delete-part-1-create/ It should cover everything you need for a basic CRUD like what you're describing. Edited May 20, 2013 by Jessica Quote Link to comment https://forums.phpfreaks.com/topic/278065-echo-a-string-by-unique-key/#findComment-1431168 Share on other sites More sharing options...
RetroSpock Posted May 20, 2013 Author Share Posted May 20, 2013 Thank you Jessica! Currently in work at the moment so I'll give it a go this evening when I get home! Quote Link to comment https://forums.phpfreaks.com/topic/278065-echo-a-string-by-unique-key/#findComment-1431176 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.