Jump to content

OO php Blog Amend


sudsy1970

Recommended Posts

 

 

Hi guys,

 

Am having trouble with my OO php blog.  i can add, delete and search for messages but cannot update them as i get the folowing eror message (see below)

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM messages WHERE id = NULL' at line 1'

 

Have checked that when i hover over the link i do get an id number and it is pointing to the correct cmd i.e. blogAmend.

 

Any ideas as to where i am going wrong, files attatched for further info.

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/218753-oo-php-blog-amend/
Share on other sites

 

ok i can't see it it but here is what i am thinking should happen:

 

the id of the selected blog gets sent to the function amendMessage, it puts it in an array called $values then calls the SQL statement below to find the entry in the db, which is returned to populate the form and should be displayed on the screen.  Is that right ?

 

 

 

 

static $amend_message =  "SELECT * FROM messages WHERE id = ?";[code=php:0]

function amendMessage($id)

  {

    $values = array($id);

    $stmt = $this->doStatement(self::$amend_message, $values);

  }

[/code]

 

function doExecute(Request $request)
  {
    $search = $request->getProperty('search');
  
    // Create manager object
    $manager = new ManagerMessage();    
    
    $data = $manager->amendMessage($search);
  
  
    // Include view
    include("views/add_form.php");
  

Link to comment
https://forums.phpfreaks.com/topic/218753-oo-php-blog-amend/#findComment-1134584
Share on other sites

  • 2 weeks later...

I'm guessing your from Wolves Uni?

Coz im doing the same thing and im stuck.

 

Its working as such, but instead of amending the blog its just posting a new one which is strange.

Did you get that working?  Very confused! I've got similar code as you too, so youve probably had the same problem :P

 

If you could help i'd be really thankful!  I've been racking my brains at it for weeks now!

 

Link to comment
https://forums.phpfreaks.com/topic/218753-oo-php-blog-amend/#findComment-1138901
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.