You need to check if you are getting errors back from the database queries. You're not checking for any errors at all and just assuming the query happens without issue. Also, you're using the variable $bdd which I assume is set from a mysql_connect() call, but we don't see how it's created to make your initial connection to the database. Are you sure it's actually set and that you actually connected in the first place?
Definitely check out the php MySQL manual section at http://www.php.net/m.../book.mysql.php and look at the error checking methods. Specifically, you should be calling mysql_error after EVERY database call. If the returned value is blank, then there wasn't an error. If a string of some kind is returned, then you had an error (and the error message is in the string).
See http://www.php.net/m...mysql-error.php for mysql_error documentation.
Here is a bit of code that shows a complete open, database select, query and close - the basics you'll need for any database use.
<?php
// --- Connect to the database server
$db = mysql_connect("localhost:3306", "username", "password");
if (!$db) {
die ("COULD NOT CONNECT TO DATABASE: " . mysql_error());
}
// --- Select the database to use
if (!mysql_select_db("my_database", $db)) {
die ("COULD NOT SELECT DATABASE: " . mysql_error());
}
// --- Do a query
$sql = "SELECT * from some_table";
$result = mysql_query($sql, $db);
if (!$result) {
die ("QUERY FAILED: " . mysql_error());
}
// ----------------------------------------------------------------
// --- Your code goes here that does something with the results of the above query
// ----------------------------------------------------------------
// --- Close the connection
mysql_close($db);
?>



Find content
Not Telling
