PHP/MySQL basic query failing

Lolslayer

So, this is a problem that is bugging me for a while now.

I've got a query I want to run with PHP, but it Always fails, even if it's very simple.

This problem only occures at one table, all other tables just work fine so it isn't a problem with connecting to the database.

Here is the code:

<?php
// Start the session
session_start();
?>

<html>
<head>
<title>Chat room</title>
</head>
<body>

<?php
  include 'opendb.php';

  $query = "SELECT id
  FROM chat";

  $resultaat = mysql_query($query, $connectie) or die('Error, query failed 1');


  include 'closedb.php';
?>

<p><?php echo $user?><?php echo $text?></p>
</form>

</body>
</html>

Yes, this actually fails, here's a link to the adress: http://ln99030804.haperen.eu/chat.php

Here's a picture showing my table on phpMyAdmin.

I also need to tell that I took some code away just to make it less chaotic, but it didn't have anything to do with the part crashing.

could anybody please help me with this?

Lolslayer

Okay, on request of @RiggsFolly I'll tell what the problem was.

The problem was that my opendb.ph and closedb.php files were on another folder then this page itself.

I didn't suspect that this was the problem because somehow other database tables didn't give an error to me, so I thought that that part was completely working.

Thanks everybody for helping me with this, it was a really stupid mistake but I was really stuck for days on this before I dared to ask on stack overflow xD

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related