MySQL num rows error

Gestart doorThom14 reacties35 weergaven

15 berichten · pagina 1 van 1

Thom

Lid · Topicstarter

Berichten
10.654
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hoi!
Als ik dit doe krijg ik de error: "Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /mnt/home/**/domains/**/public_html/**/reacties.php on line 12"

[COLOR= #0000BB]<?php

    $selReacties[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM messages WHERE on_which="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" ORDER BY id DESC"[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$selReacties[/COLOR][COLOR= #007700]){[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$selReacties[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]){[/COLOR]

            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]geen reacties.[/COLOR][COLOR= #007700];

        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]

            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]woah wel reacties[/COLOR][COLOR= #007700];

        }
    }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]();
    }[/COLOR]

?>


Lijn 12 is de query..
$fetch[id] klopt; er kwam een gewoon getal uit.

toevoeging op 7 juni 2012, 20:36:45:
Het zal wel een domme fout zijn, maar ik kom er niet uit yummie
0
Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Waarom if($sellreacties) terwijl je eigenlijk hetzelfde doet met num rows?
0
Thom

Lid · Topicstarter

Berichten
10.654
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Shahiem schreef:
Waarom if($sellreacties) terwijl je eigenlijk hetzelfde doet met num rows?
Geen idee yummieMaar dat maakt nu niet uit.. lijkt me q
0
Berichten
6.485
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Blijkbaar maak je door if($selReacties){ te doen een BOOLEAN van $selReacties.

Geen idee wat het anders kan zijn, ik zie voor de rest niets fout.
0
Thom

Lid · Topicstarter

Berichten
10.654
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Rogier schreef:
Blijkbaar maak je door if($selReacties){ te doen een BOOLEAN van $selReacties.

Geen idee wat het anders kan zijn, ik zie voor de rest niets fout.
Nee want dat had ik ook al weggehaald en maakte geen verschil.
0
Berichten
4.451
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
En als je nou is dit doet:

[COLOR= #0000BB]<?php

    $selReacties[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM messages WHERE on_which="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" ORDER BY id DESC"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$selReacties[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]){[/COLOR]

            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]geen reacties.[/COLOR][COLOR= #007700];

        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]

            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]woah wel reacties[/COLOR][COLOR= #007700];

        }[/COLOR]

?>


Gewoon proberen
0
Thom

Lid · Topicstarter

Berichten
10.654
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Bartv schreef:
En als je nou is dit doet:

[COLOR= #0000BB]<?php

    $selReacties[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM messages WHERE on_which="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" ORDER BY id DESC"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$selReacties[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]){[/COLOR]

            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]geen reacties.[/COLOR][COLOR= #007700];

        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]

            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]woah wel reacties[/COLOR][COLOR= #007700];

        }[/COLOR]

?>
Gewoon proberen

Heb ik ook al gedaan.
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Neem aan dat je wel een connectie hebt?

Doe eens een var_dump() op: $selReacties?
0
Berichten
4.451
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Zoals aarclay zegt:

[COLOR= #0000BB]<?php[/COLOR]

[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]config.php[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #FF8000]// Je config bestand[/COLOR]

    [COLOR= #0000BB]$selReacties[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM messages WHERE on_which="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" ORDER BY id DESC"[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$selReacties[/COLOR][COLOR= #007700]){[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$selReacties[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]){[/COLOR]

            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]geen reacties.[/COLOR][COLOR= #007700];

        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]

            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]woah wel reacties[/COLOR][COLOR= #007700];

        }
    }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]();
    }[/COLOR]

?>
0
Thom

Lid · Topicstarter

Berichten
10.654
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hij doet het op een een of andere manier nu wel.. (zonder iets te veranderen) yummie
0
Berichten
4.451
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Thommity schreef:
Hij doet het op een een of andere manier nu wel.. (zonder iets te veranderen) yummie
Dus je code is nu:

[COLOR= #0000BB]<?php

    $selReacties[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM messages WHERE on_which="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" ORDER BY id DESC"[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$selReacties[/COLOR][COLOR= #007700]){[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$selReacties[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]){[/COLOR]

            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]geen reacties.[/COLOR][COLOR= #007700];

        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]

            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]woah wel reacties[/COLOR][COLOR= #007700];

        }
    }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]();
    }[/COLOR]

?>


Helemaal niks anders?
0
Thom

Lid · Topicstarter

Berichten
10.654
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Bartv schreef:
Eerdere citaten tonen
Thommity schreef:
Hij doet het op een een of andere manier nu wel.. (zonder iets te veranderen) yummie
Dus je code is nu:

[COLOR= #0000BB]<?php

    $selReacties[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM messages WHERE on_which="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" ORDER BY id DESC"[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$selReacties[/COLOR][COLOR= #007700]){[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$selReacties[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]){[/COLOR]

            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]geen reacties.[/COLOR][COLOR= #007700];

        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]

            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]woah wel reacties[/COLOR][COLOR= #007700];

        }
    }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]();
    }[/COLOR]

?>


Helemaal niks anders?
Er staat nog wel een hoop omheen yummie
0
Berichten
4.451
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Thommity schreef:
Eerdere citaten tonen
Bartv schreef:
Eerdere citaten tonen
Thommity schreef:
Hij doet het op een een of andere manier nu wel.. (zonder iets te veranderen) yummie
Dus je code is nu:

[COLOR= #0000BB]<?php

    $selReacties[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM messages WHERE on_which="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" ORDER BY id DESC"[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$selReacties[/COLOR][COLOR= #007700]){[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$selReacties[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]){[/COLOR]

            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]geen reacties.[/COLOR][COLOR= #007700];

        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]

            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]woah wel reacties[/COLOR][COLOR= #007700];

        }
    }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]();
    }[/COLOR]

?>


Helemaal niks anders?
Er staat nog wel een hoop omheen yummie
Ja oke dat snap ik maar je moet wel iets veranderd hebben, want is een beetje raar als ie t ineens doet, mij maakt het niet uit maar ik bedoel voor mensen die hetzelfde probleem heeft.
0
Thom

Lid · Topicstarter

Berichten
10.654
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Bartv schreef:
Eerdere citaten tonen
Thommity schreef:
Eerdere citaten tonen
Bartv schreef:
Eerdere citaten tonen
Thommity schreef:
Hij doet het op een een of andere manier nu wel.. (zonder iets te veranderen) yummie
Dus je code is nu:

[COLOR= #0000BB]<?php

    $selReacties[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM messages WHERE on_which="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" ORDER BY id DESC"[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$selReacties[/COLOR][COLOR= #007700]){[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$selReacties[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]){[/COLOR]

            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]geen reacties.[/COLOR][COLOR= #007700];

        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]

            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]woah wel reacties[/COLOR][COLOR= #007700];

        }
    }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]();
    }[/COLOR]

?>


Helemaal niks anders?
Er staat nog wel een hoop omheen yummie
Ja oke dat snap ik maar je moet wel iets veranderd hebben, want is een beetje raar als ie t ineens doet, mij maakt het niet uit maar ik bedoel voor mensen die hetzelfde probleem heeft.
Ik heb geen idee wat ik dan heb veranderd wink
0
Berichten
4.451
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Thommity schreef:
Eerdere citaten tonen
Bartv schreef:
Eerdere citaten tonen
Thommity schreef:
Eerdere citaten tonen
Bartv schreef:
Eerdere citaten tonen
Thommity schreef:
Hij doet het op een een of andere manier nu wel.. (zonder iets te veranderen) yummie
Dus je code is nu:

[COLOR= #0000BB]<?php

    $selReacties[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM messages WHERE on_which="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$fetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]" ORDER BY id DESC"[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$selReacties[/COLOR][COLOR= #007700]){[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$selReacties[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]){[/COLOR]

            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]geen reacties.[/COLOR][COLOR= #007700];

        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]

            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]woah wel reacties[/COLOR][COLOR= #007700];

        }
    }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]();
    }[/COLOR]

?>


Helemaal niks anders?
Er staat nog wel een hoop omheen yummie
Ja oke dat snap ik maar je moet wel iets veranderd hebben, want is een beetje raar als ie t ineens doet, mij maakt het niet uit maar ik bedoel voor mensen die hetzelfde probleem heeft.
Ik heb geen idee wat ik dan heb veranderd wink
Ow oke, nja niks aan te doen wink
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren