Need enlightenment about the following:
I'm trying to adapt my php pages to mysqli. Everything seems to work after a few minor changes except a number of functions (as far as I can tell it's the ones where a function is called inside another function or where the same function is called again at the end of itself: I'll stick to the first problem for now).
The setup is this: I have a separate php page with a bunch of functions (called "functies.php") which is included in most pages with
Expand|Select|Wrap|Line Numbers
- include("functies.php");
This is the code for "songschrijver":
Expand|Select|Wrap|Line Numbers
- <?php
- function songschrijver($songid){
- $resultaat = mysqli_query($con, "SELECT Auteur_ID, Uitvoerder FROM songs_met_auteurs, uitvoerders_zonder_instr
- WHERE Auteur_ID = uitvoerders_zonder_instr.ID
- AND Song_ID =" . $songid . "
- ORDER BY Uitvoerder");
- $rij = mysqli_fetch_array($resultaat);
- if (mysqli_num_rows($resultaat) > 1){
- if (mysqli_num_rows($resultaat) == 2){ ?>
- <a href="resultaten_per_auteur.php?nummer= <?php echo $rij['Auteur_ID']; ?>">
- <?php herschiknaam2($rij['Uitvoerder']); ?></a>
- <?php $rij = mysqli_fetch_array($resultaat);
- print " & "; ?>
- <a href="resultaten_per_auteur.php?nummer= <?php echo $rij['Auteur_ID']; ?>">
- <?php herschiknaam2($rij['Uitvoerder']); ?></a>
- <?php
- }
- else{ ?>
- <a href="resultaten_per_auteur.php?nummer= <?php echo $rij['Auteur_ID']; ?>">
- <?php herschiknaam2($rij['Uitvoerder']); ?></a>
- <?php $rij = mysqli_fetch_array($resultaat);
- while ($rij){
- print ", "; ?>
- <a href="resultaten_per_auteur.php?nummer= <?php echo $rij['Auteur_ID']; ?>">
- <?php herschiknaam2($rij['Uitvoerder']); ?></a>
- <?php $rij = mysqli_fetch_array($resultaat);
- }
- }
- }
- else{ ?>
- <a href="resultaten_per_auteur.php?nummer= <?php echo $rij['Auteur_ID']; ?>">
- <?php herschiknaam($rij['Uitvoerder']); ?></a><?php
- }
- }
- ?>
This worked perfectly with the mysql formulae (e.g. mysql_query, mysql_fetch_array, etc.) but doesn't anymore with mysqli (mysqli_query, etc.). When before it would display "Yesterday (Lennon & McCartney)", the same page now says "Yesterday ()". Is this something to do with calling functions inside functions?
Any help would be much appreciated.