Bonjour,
j'ai du mal à corriger une erreur qui s'affiche lors de l'exécution de mon programme. L'intitulé de l'erreru est :
"Undefined offset'' sur la ligne 22, dont j'ai mis en rouge. Je vous remercie d'avance de votre aide.

Voici le code:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
 
 <?php
	function getListOptionCategories()
	{
        $libelle    = '<option value="">Sélectionnez une catégorie</option>';
        $sql = sprintf("SELECT * FROM categorie");
        $result = mysql_query($sql) or die(mysql_error());
        if(mysql_num_rows($result)>0)
        {
            while ($row = mysql_fetch_object($result))
            {
                $libelle .= '<option value="'.$row->id_categ.'">'.$row->categorie.'</option>';
            }
        }
 
        return $libelle;
	}
 
    //TRANSFORME UNE DATE FR EN TIMESTAMP
    //exemple 25/05/2012 => 1245547987
    function dateFrToTimeStamp($date)
    {
        list($day, $month, $year) = explode('/', trim($date));
        $timestamp = gmmktime(0, 0, 0, intval($month), intval($day), intval($year));
        return $timestamp;
    }
 
    //TRANSFORME UN TIMESTAMP EN DATE FR
    //exemple 214554854 => 25/05/2012
    function timestampToDateMysqlGMT($tym)
    {
        return date("Y-m-d", $tym);
    }
 
    //TRANSFORME UNE DATE FR EN DATE POUR DB MYSQL
    //exemple 25/05/2012 => 2012/05/25
    function dateFrToDateMysqlGMT($date)
    {
        $timestamp = dateFrToTimeStamp(trim($date));
        return timestampToDateMysqlGMT($timestamp);
    }
 
    //TRANSFORME UNE DATE MYSQL EN DATE FR
    //exemple  2012/05/25 => 25/05/2012
    function mysqlDateToDateFr($str)
    {
        $timestamp = mysqlDateToTimeStamp(trim($str));
        return timestampToDateFr($timestamp);
    }
 
    //TRANSFORME UNE DATE MYSQL EN TIMESTAMP
    //exemple  2012/05/25 => 1258965478
   function mysqlDateToTimeStamp($str) // ligne 22
    {
        $timestamp = strtotime(trim($str));
        return $timestamp;
        /*
        list($date, $time) = explode(' ', $str);
        list($year, $month, $day) = explode('-', $date);
        list($hour, $minute, $second) = explode(':', $time);
        $timestamp = mktime($hour, $minute, $second, $month, $day, $year);
        return $timestamp;*/
    }
 
    //TRANSFORME UNE DATE MYSQL EN DATE FR
    //exemple  1258965478 => 25/05/2012
    function timestampToDateFr($timestamp)
    {
        return date("d/m/Y", trim($timestamp));
    }
 
 
?>