Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1068549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:18:08+00:00 2026-05-16T20:18:08+00:00

Why does this pdo::mysql code crash on windows??? <?php $username = root; $password =

  • 0

Why does this pdo::mysql code crash on windows???

<?php
$username = "root";
$password = "";

try {
    $dsn = "mysql:host=localhost;dbname=employees";
    $dbh = new PDO($dsn, $username, $password);
    $dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, FALSE);
    $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

echo "Connected to database<br />" ;

$dbh->exec("DROP TABLE IF EXISTS vCard;");
$dbh->exec("DROP TABLE IF EXISTS emp;");

$table = "CREATE TABLE vCard(
    id INT(4) NOT NULL PRIMARY KEY, 
    firstName VARCHAR (255), 
    lastName VARCHAR (255), 
    office VARCHAR (255), 
    homePh VARCHAR (13), 
    mobilePh VARCHAR (13))";

$dbh->exec($table);

$dbh->beginTransaction();

$dbh->exec("INSERT INTO vCard(id, firstName, lastName, office, homePh, mobilePh)
    VALUES (4834, 'Randy', 'Lewis', 'SR. Front End Developer', '631-842-3375', '917-435-2245');");

$dbh->exec("INSERT INTO vCard(id, firstName, lastName, office, homePh, mobilePh)    
    VALUES (0766, 'Frank', 'LaGuy', 'Graphic Designer', '631-789-8244', '917-324-9897');");

$dbh->exec("INSERT INTO vCard(id, firstName, lastName, office, homePh, mobilePh)    
    VALUES (6684, 'Donnie', 'Dolemite', 'COO', '631-789-9482', '917-234-1222');");

$dbh->exec("INSERT INTO vCard(id, firstName, lastName, office, homePh, mobilePh)    
    VALUES (8569, '', 'McLovin', 'Actor', '631-842-9786', '917-987-8944');");

$dbh->commit();

echo "Data entered successfully<br/><br/>";

    $sql = "SELECT * FROM vCard"; // WHERE firstName = 'Donnie'";

    $results = $dbh->query($sql);

    foreach ($results as $id){
        echo "SSN: ". $id['id']." ";
        echo "First Name: ". $id['firstName']." ";
        echo "Last Name: ". $id['lastName']."<br/>";
    }

}   
catch (PDOException $e) {
    echo "Failed: " . $e->getMessage();
    $dbh->rollback();
}   

?>

basically this line of code is what triggers Apache to crash..

    $sql = "SELECT * FROM vCard"; 

If I try to select one value like ‘id’ it’ll … when I try to select more than one value “*” it crashes??????

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T20:18:08+00:00Added an answer on May 16, 2026 at 8:18 pm

    The right way is to recompile mysql mysqli and pdo_mysql php modules with the good mysql headers (from mysql sources)

    But setting up the good dev environment is hard (Windows SDK, VC6 command line, and all needed libs)

    In fact, there are protocol versions (you can see in mysql headers, a file named version.h).

    I make that for my WAMP package, named EWS – Easy Web Server, for each new release

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class with this in self::$DB = new PDO(mysql:dbname=$dbname;host:=127.0.0.1 , 'root' ,
My procedures mysql already does inserts correctly: this is my php code calling the
I am trying to run this simple SELECT query using PDO::MySQL, but it does
I have a very simple test script: <?php $DSN = "mysql:host=db.example.edu;port=3306;dbname=search_data"; try { $DB
I've got the following saved into my dbConnect.php file $host = 'localhost'; $username =
Does this code always evaluate to false? Both variables are two's complement signed ints.
Does this code cause a memory leak: int main(){ int * a = new
Does this code work across all standard compliant C++ compilers (it works with g++)?
My scripts are definitely saved in UTF-8. I'm instantiating PDO with {$this->engine}:host={$this->host};dbname={$this->name};charset=UTF-8 . My
So after reading Performance in PDO / PHP / MySQL: transaction versus direct execution

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.