Jump to content

CommonEnemy

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Posts posted by CommonEnemy

  1. Right, I read it but since I'm not used to object/class programming I assumed that the database connection object could be represented as an integer which I could echo to see if my open function succeeded or not. That aside, I've cleaned up my query and I'm getting this error:

     

    Warning: PDO::exec(): SQLSTATE[HY000]: General error: 1 near "Morrison": syntax error in C:\inetpub\wwwroot\form.php on line 26 Array ( [0] => HY000 [1] => 1 [2] => near "Morrison": syntax error )

     

    Where Morrison is the name. I've used sqlite before, awhile ago mind, and I can't see the syntax error regarding the query. Could it be a PHP error I've made?

     

    Got that one sorted out, forgot about the ' ' since they were already there for adding the strings together. New problem is:

     

    Warning: PDO::exec(): SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in C:\inetpub\wwwroot\form.php on line 26 Array ( [0] => HY000 [1] => 8 [2] => attempt to write a readonly database ) 

     

    But I think I can handle it on my own, thanks for all your help.

  2. This is bothering me beyond belief I'm hoping that someone here might be able to help me. I've tried playing around with a few permissions, that could be the problem. Basically if I try to create/open a database it will create an error I've narrowed it down to this one line and it's the first one which leads me to believe that it's either a php configuration problem or a permissions thing. Running IIS 7.0

     

    <html>
    <body>
    <?php
    $dbh = new PDO('sqlite:poems.sqlite');
    ?>
    
    <?php
    //phpinfo();
    $name=$_POST["userName"];
    $contact=$_POST["userContact"];
    $poem=str_replace("
    ","<br />",$_POST["userPoem"]);
    $comment=str_replace("
    ","<br />",$_POST["userComment"]);
    
    
    
    
    $query='INSERT INTO '.$dbh.' (name,contact,body,desc) VALUES ('.$name.','.$contact.','.$poem.','.$comment.')';
    echo $query;
    /*$db->exec('INSERT INTO '.$db.' (name,contact,body,desc) VALUES ('.$name.','.$contact.','.$poem.','.$comment.')');*/
    ?>
    
    <p>
    <b>Your name:</b> <?php echo $name; ?><br />
    <b>Your contact info:</b> <?php echo $contact; ?><br />
    <b>Your Poem:</b><br /> <?php echo $poem; ?><br />
    <b>Your Comments:</b><br /> <?php echo $comment; ?>
    </p>
    </body>
    </html> 
    
    <?php $dbh = null; ?> 

     

    Any and all help is appreciated. Would Apache be any better? I'm considering just switching over if so.

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