SitePoint Sponsor

User Tag List

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

    Unhappy I do a select query picking 2 fields and my apache server closes down??

    I got everfything up and running only a few days ago following a tutorial... so pretty new, but the script was copied and pasted, makes sense to me, but the problem is select one field from the database, all fine, can echo it, but select two fields, same table the apache server falls over and I get a pop up message saying that there was a problem and the server closed.

    So what do I do... download another copy of apache, is the set up wrong on it...? I am mythed.



    Cheers


    Mark

  2. #2
    SitePoint Wizard
    Join Date
    Oct 2005
    Location
    London
    Posts
    1,678
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could we have some code/screenshots of your problem? It's best to be as descriptive as possible when asking questions in any forum. The better people understand the more likely they are to answer

    A popup message as in a javascript alert box?

    What makes you think your server is falling over?

  3. #3
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  4. #4
    SitePoint Member
    Join Date
    Aug 2009
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is an attachment of the message, I am afraid it is in portuguese.

    The script is below; if I change the script from $result = mysqli_query($link, 'SELECT CityName, Population FROM city');

    to not include Population or any other field, or use a different database and try to select two fields from the query then it will fail and I get the attachment which basically says Apache has encountered an error.

    <?php
    $link = mysqli_connect('localhost', 'root', '');
    if (!$link)
    {
    $error = 'Unable to connect to the database server.';
    include 'error.html.php';
    exit();
    }
    if (!mysqli_set_charset($link, 'utf8'))
    {
    $output = 'Unable to set database connection encoding.';
    include 'output.html.php';
    exit();
    }
    if (!mysqli_select_db($link, 'tripbockdb'))
    {
    $error = 'Unable to locate the joke database.';
    include 'error.html.php';
    exit();
    }
    $result = mysqli_query($link, 'SELECT CityName, Population FROM city');
    if (!$result)
    {
    $error = 'Error fetching jokes: ' . mysqli_error($link);
    include 'error.html.php';
    exit();
    }
    while ($row = mysqli_fetch_array($result))
    {
    $Cities[] = array(CityName => $row['CityName'], Population => $row['Population']);
    }
    include 'city.html.php';
    ?>

    Many thanks

    Mark
    Attached Images Attached Images


Tags for this Thread

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
  •