sql limit probleem

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Jonas vermeulen

jonas vermeulen

21/10/2009 19:38:00
Quote Anchor link
hi all,

ik heb het volgende script om de topics van mijn forum (flash forum dat werkt met php en xml ) op te vragen

nu krijg ik volgnde uitvoer :
Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
1 Welkom op het forum
Warning: mysqli_bind_param() expects parameter 1 to be mysqli_stmt, boolean given in /home/vol8/byethost10.com/b10_3322909/htdocs/gettopics.php on line 29

Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, boolean given in /home/vol8/byethost10.com/b10_3322909/htdocs/gettopics.php on line 30

Warning: mysqli_bind_result() expects parameter 1 to be mysqli_stmt, boolean given in /home/vol8/byethost10.com/b10_3322909/htdocs/gettopics.php on line 31

Warning: mysqli_stmt_fetch() expects parameter 1 to be mysqli_stmt, boolean given in /home/vol8/byethost10.com/b10_3322909/htdocs/gettopics.php on line 32
9 2 Introduce yourself
Warning: mysqli_bind_param() expects parameter 1 to be mysqli_stmt, boolean given in /home/vol8/byethost10.com/b10_3322909/htdocs/gettopics.php on line 29

Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, boolean given in /home/vol8/byethost10.com/b10_3322909/htdocs/gettopics.php on line 30

Warning: mysqli_bind_result() expects parameter 1 to be mysqli_stmt, boolean given in /home/vol8/byethost10.com/b10_3322909/htdocs/gettopics.php on line 31

Warning: mysqli_stmt_fetch() expects parameter 1 to be mysqli_stmt, boolean given in /home/vol8/byethost10.com/b10_3322909/htdocs/gettopics.php on line 32
2 3 test multiple topics
Warning: mysqli_bind_param() expects parameter 1 to be mysqli_stmt, boolean given in /home/vol8/byethost10.com/b10_3322909/htdocs/gettopics.php on line 29

Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, boolean given in /home/vol8/byethost10.com/b10_3322909/htdocs/gettopics.php on line 30

Warning: mysqli_bind_result() expects parameter 1 to be mysqli_stmt, boolean given in /home/vol8/byethost10.com/b10_3322909/htdocs/gettopics.php on line 31

Warning: mysqli_stmt_fetch() expects parameter 1 to be mysqli_stmt, boolean given in /home/vol8/byethost10.com/b10_3322909/htdocs/gettopics.php on line 32
3 6 test mc pages
Warning: mysqli_bind_param() expects parameter 1 to be mysqli_stmt, boolean given in /home/vol8/byethost10.com/b10_3322909/htdocs/gettopics.php on line 29

Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, boolean given in /home/vol8/byethost10.com/b10_3322909/htdocs/gettopics.php on line 30

Warning: mysqli_bind_result() expects parameter 1 to be mysqli_stmt, boolean given in /home/vol8/byethost10.com/b10_3322909/htdocs/gettopics.php on line 31

Warning: mysqli_stmt_fetch() expects parameter 1 to be mysqli_stmt, boolean given in /home/vol8/byethost10.com/b10_3322909/htdocs/gettopics.php on line 32
1
Warning: mysqli_stmt_close() expects parameter 1 to be mysqli_stmt, boolean given in /home/vol8/byethost10.com/b10_3322909/htdocs/gettopics.php on line 48

? wat doe ik mis dan?
Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
<?php
// maak verbinding met database:
$link = mysqli_connect("xxxxxxxxxxxxxxxxxx", "xxxxxxxxxx", "gxxxxxxxxxxxxxr", "xxxxxxxxxxxxxxe");

//variabelen die in de query ingevuld worden:

$forum_id = $_POST['forum_id'];
$page = $_POST['page'];
$page = 1;
$forum_id = "1";

$query = "SELECT TOPIC_ID, TOPIC_NAME FROM WROX_TOPICS WHERE FORUM_ID='". $forum_id ."'";
$result = mysqli_query($link, $query);

if ($page == 1){
    $stmt = mysqli_prepare($link, "SELECT TIME, USER FROM WROX_MESSAGES WHERE TOPIC_NAME=? ORDER BY TIME DESC LIMIT 0,'". ($page*15) ."'")  ;  
}
else{
    $stmt = mysqli_prepare($link, "SELECT TIME, USER FROM WROX_MESSAGES WHERE TOPIC_NAME=? ORDER BY TIME DESC LIMIT'". (($page-1)*15) . "', '" . ($page*15). "'");
}

$stmt2 = mysqli_prepare($link, "SELECT COUNT(MESSAGE_ID) FROM WROX_MESSAGES WHERE TOPIC_NAME=?");

echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
echo "<topics>\n";
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){
    echo "<topic>\n";
        echo "<id>". $row['TOPIC_ID'] . "</id>\n";
        echo "<topic_name>". $row['TOPIC_NAME']. "</topic_name>\n";
        
    mysqli_bind_param($stmt, "s", $row["TOPIC_NAME"]);
    mysqli_stmt_execute($stmt);
    mysqli_bind_result($stmt, $time, $user);
    while (mysqli_stmt_fetch($stmt)){
        echo "<time>". $time. "</time>\n";
        echo "<user>". $user ."</user>\n";
    }

      
    mysqli_bind_param($stmt2, "s", $row["TOPIC_NAME"]);
    mysqli_stmt_execute($stmt2);
    mysqli_bind_result($stmt2, $count);
    while(mysqli_stmt_fetch($stmt2)){
        echo "<count>". $count ."</count>\n";
    }

    echo "</topic>\n";
}

echo "</topics>\n";

/* sluit de statement af: */  
mysqli_stmt_close($stmt);
mysqli_stmt_close($stmt2);            

/* sluit de database-verbinding */
mysqli_close($link);

?>
Gewijzigd op 01/01/1970 01:00:00 door Jonas vermeulen
 
PHP hulp

PHP hulp

22/12/2024 19:08:00
 
- SanThe -

- SanThe -

21/10/2009 19:46:00
Quote Anchor link
Je script in je post is nu niet echt leesbaar. Pas je post even aan en gebruik en tags om je code heen. Om php code zet je uiteraard dit:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
<?php en ?>
Gebruik je Afbeelding knop om dit te doen.

SanThe.
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.