Jump to content

sudsy1970

Members
  • Posts

    91
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

sudsy1970's Achievements

Member

Member (2/5)

0

Reputation

  1. ok have struggled on a bit more and now i have the error message This is pointing to the colon, i have tried adding a " afterwards as i thought it may view it as a special charaacter but end up with the same error. Can one explain it to me please ?
  2. very similiar to search i think static $get_message = "SELECT id,title,message FROM messages WHERE id = ?" ; function getOneMessage($id) { $values = array($id); $stmt = $this->doStatement(self::$get_message, $values); $result = $stmt->fetchAll(); return $result; }
  3. that is because when the message amend is selected the id is passed via php so the table knows which entry to get. I will check on whether i have entered the code correctly, not at pc at present. Can i just check i have a folder called assignment with all my files for the blog, if i just create the triggers i need and save them in the same folder, will they automatically 'trigger' or do i need to call them, if so how ?
  4. Because of : Advanced Web Technologies Assessment 1 – Website marking sheet Student name and number: Marker: Mark and comments Basic functionalities - Articles can be added and viewed 1 point - Articles can be amended and deleted 1 point - You can search for articles 1 point (3 points) OO Programming and Patterns - You have used OO programming techniques (inheritance, static methods, abstract classes etc.) when appropriate. 1 point - Your website is based on a suitable Architectural Pattern (1 point for the example featured on the Wiki) 3 points (4 points) Versioning - A history of versions is kept 1 point - Versions can be compared 1 point - Articles can be rolled back to older versions 1 point (3 points)RSS - The website is consuming (parsing and appropriately displaying) an existing feed. 1 point - The website is dynamically producing its own compliant web feed. 1 point (2 points) API - The website makes use of an API to offer useful functionality (e.g. search, spelling, social networking, ecommerce, etc.)) Note: Reusing the examples from the Wiki will NOT grant you any points! 1 point for simple use (e.g. widget) 2 points for complex REST/SOAP request (2 points) Ajax - The user experience is improved by appropriate use of Ajax technology (live search, form filling assistance…) 1 point per Ajax feature, up to a max. of 2 points (2 points) Total ________ out of 16
  5. Ok so i have tried again, basically what needs to happen is Select * from messages where ID = ? THEN Insert into messages_audit (info from above THEN delete from messages where ID = ? Have tried to create a trigger to make this happen which goes like: mysql> Delimiter // mysql> CREATE TRIGGER messages_bd -> BEFORE DELETE ON messages ->FOR EACH ROW ->BEGIN ->INSERT INTO messages_audit (id,title,message,date_added) VALUES (SELECT * FROMmessages WHERE ID = ?); ->END// A) does this seem to be ok B) i get the error code Anyone got any ideas please ?
  6. sorry should have said, I have already tried that and still get the same error message. When i posted the the code i hadn't realised i had moved the <? tag when fiddling. have also been playing with my link tag when i think should read : $feed.="<link>localhost/bloggy/index.php</link>"; does this look right for the file on a web server ?
  7. Anyone any ideas on why the sql could be causing this error ?
  8. I did look up triggers and found it very confusing which is why i asked for help in the first place. Perhaps the scorn passed from you is not worth the extra mark i could receive !
  9. ahh hah, right thanks for that, found it and navigated to it to find XML Parsing Error: not well-formed Location: http://127.0.0.1/bloggy/rss.xml Line Number 15, Column 3: $sql = "SELECT title FROM messages ORDER BY date_added DESC limit 0,10"; --^
  10. as the feed does not work, will there be an output and if so how do i see it ?
  11. Hi i have a simple blog which is stored in a table called messages, i have tried to create an rss feed that poeple can link to but am a bit stuck. the feed does not validate with the error code of: Sorry This feed does not validate. line 15, column 2: XML parsing error: <unknown>:15:2: not well-formed (invalid token) [help] $sql = "SELECT title FROM messages ORDER BY date_added DESC limit 0,10"; Anybody got any ideas on this please, have read the rss pages and can comsume a fedd ok just cant produce one. <?php $host = ""; $user = ""; $pass = ""; $port = "3306"; $database = "uni"; $MySQL = mysql_connect( "$host:$port", $user, $pass ); mysql_select_db( $database, $MySQL) or die ( "Couldn't open $database: ".mysql_error() ); ?> // Get latest items from db $sql = "SELECT title FROM messages ORDER BY date_added DESC limit 0,10"; $rst = mysql_query($sql); // Loop through data and build feed items $items = ""; while($a_row = mysql_fetch_assoc($rst)) { $items.= "<item>"; $items.= " <title>{$rst['title']}</title>"; $items.= " <link>{$rst['link']}</link>"; $items.= " <description>{$rst['description']}</description>"; $items.= "</item>"; } // Build feed text $feed = "<?xml version=\"1.0\"?>"; $feed.= "<rss version=\"2.0\">"; $feed.= " <channel>"; $feed.= " <title>My cool feed</title>"; $feed.= " <link>http://mi-linux.wlv.ac.uk/~0274148/AWT/blog/index.php</link>"; $feed.= " <description>A cool feed</description>"; $feed.= " $items"; $feed.= " </channel>"; $feed.= "</rss>"; // Display feed text echo $feed;
  12. Well it didn't work anyway and this is only to show it can be done for a project, if i can get it working it could provide extra points. i have a php function that calls the sql code so might just see if i can add to that to back up the record i am deleting.
  13. ok have had a go and have got the following does that look right ? [code ]CREATE TRIGGER CreatePostRevision BEFORE UPDATE ON messages FOR EACH ROW BEGIN INSERT INTO messages_audit (title,message,date_added) values(?,?,?) VALUES (OLD.<title>,OLD.<message>,OLD.<date_added>) END; Now can i just write another trigger for a delete ? where does the code sit, do i just make a sql folder and leave it in there as i am thinking that this will always trigger whenever the update/delete is executed ? Thanks for your patience
  14. have tried for ages and i am stuck. The code to enter in the info into my blog table is: INSERT INTO messages(title,message,date_added) values(?,?,?) if i ever get the amend to work it will find it via $id SELECT id,title,message FROM messages WHERE id = ? so if i select the message , insert it to a backup table and also update the original table will i get : SELECT id,title,message FROM messages WHERE id = ? INSERT INTO messages_audit(title,message,date_added) values(?,?,?) AND UPDATE messages(title,message,date_added) values(?,?,?) If this is right can i use a simialr approach for delete and add ?
  15. Thanks for the reply, i have a very simple table, with an id number, title, message and date added entries, so i am guessing that just getting another table called versions would be a n easier option. i shall attempt that as i only really need to demo that it can be done, will post the code when i get stuck lol
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.