SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Oct 2009
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP displaying mysql content problem

    Well hi, just signed in to this forum and I have this problem;
    I am trying to display the content of a mysql database table for a webpage project of my school and I have this php code:

    <?php
    $con = mysqli_connect("localhost","root");
    if (!$con)
    {
    $output = 'Unable to connect to the database server.';
    exit();
    }

    mysqli_select_db($con, "accnts45673");

    $result = mysqli_query($con, "SELECT * FROM login_tbl");
    if (!$result)
    {
    $error = 'Ha habido un error: ' . mysqli_error($con);
    include 'error.html.php';
    exit();
    }

    echo "<table border='3' align='center'>
    <tr>
    <th bgcolor='FFCC66'><u>Usuario</u></th>
    <th bgcolor='FFCC66'><u>Contraseņa</u></th>
    </tr>";

    while($row = mysqli_fetch_array($result))
    {
    echo "<tr>";
    echo "<td>" . $row['loginid'] . "</td>";
    echo "<td>" . $row['password'] . "</td>";
    echo "</tr>";
    }
    echo "</table>";

    mysqli_close($con);
    ?>

    However, when I make the query to select the content of the database and try to open the webpage to try it, it doesn't open and a message appears saying that Apache stopped working, I tried selecting only one row by writing "SELECT loginid FROM login_tbl" instead, and it works with no problem, the problem seems to be when I try to select more than one row of the database table because it does't work if I write "SELECT loginid, password FROM login_tbl" either, I just can't selec all of the rows or more than one at a time or the page does't open and appears the message that apache stopped working.

    So that is my weirdo problem which have to solve before monday or I fail this semester. (Yeah the pressure on me)
    I have apache 2.2.13 and PHP 5.2.11

    Anyway If anyone can help I will owe you a greeeeaaaaaat favor
    Thanks in advance

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try installing the latest version of php.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2009
    Location
    Newcastle Australia
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I and others had a similar problem with apache and I was using php 5.2.10 and someone suggested installing VC6 Thread Safe version of PHP 5.3 for Windows.

    It fixed my problem.

    I'm guessing you have this installed on you computer?
    Kevin

  4. #4
    SitePoint Member
    Join Date
    Oct 2009
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thx I after a lot of configuring the apache files to work with php 5.3 i finally installed and solved my prob

  5. #5
    SitePoint Zealot
    Join Date
    Jul 2006
    Posts
    112
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am not sure what's going on...because I had the same problem and had to downgrade from 5.3 to 5.2.11 to solve the issue...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •