Chezshire Posted August 3, 2008 Share Posted August 3, 2008 Hello I'm trying to produce a list of every character listed by their squadrons and then produce a list of said characters with each group appearing by their squadron name first basically - it's the first step to what i'm hoping to ultimately do. As i'm not a great coder i'm trying to do everything in small pieces. Line # 53 produces the following error:Fatal error: Call to undefined function: getsquadrondb() in /home/content/z/a/n/zanland/html/xpg/institute/institute1.2.php on line 53 This is everything up to line #53 code wise <?php //get characters by squadron $sql = "SELECT id, squadronDB, codename FROM cerebra ORDER BY squadronDB"; $result = mysql_query($sql) or trigger_error(mysql_error,E_USER_ERROR); while($row = mysql_fetch_assoc($result)){ //here's the key. Use a while loop to repeat through the code $thisID = $codename["id"]; $squadronDB= getsquadronDB($thisID); This is the full block of code. <?php //get characters by squadron $sql = "SELECT id, squadronDB, codename FROM cerebra ORDER BY squadronDB"; $result = mysql_query($sql) or trigger_error(mysql_error,E_USER_ERROR); while($row = mysql_fetch_assoc($result)){ //here's the key. Use a while loop to repeat through the code $thisID = $codename["id"]; $squadronDB= getsquadronDB($thisID); $squadronDB = getChar($char_ID); // start character div echo '<div style="float: left; padding-top: 5; width: 220;">'; echo "<span class='fineprint'>"; // makes thin bar echo '<hr align="centered" color="#050F1D" size="2" width="66%">'; // image div echo '<div style="float: left; padding-left: 5;"><img src="/cerebra/images/'.$row['id'].'-.jpg" width="60" height="75" border="2px" bordercolor="#415582"></div>'; // name div // styles echo '<div style="float: left; vertical-align: top; padding-left: 5;"><p>'; // span and model name echo '<span class="fineprint"><i>'.$row['squadronDB']; // link and codename echo ' <br>as <a href="/cerebra/display.php?id='.$row['id'].'">'.$row['codename'].'</a></i></span></p></div>'; // end character div echo '</div>'; //these two lines (or any lines up to the closing brace) will be repeated for each row returned by the query } ?> Any suggestions, help or guidance as always is very much appreciated thank you -Chez Link to comment https://forums.phpfreaks.com/topic/117922-it-appears-that-my-function-is-ill-defined-help/ Share on other sites More sharing options...
JasonLewis Posted August 3, 2008 Share Posted August 3, 2008 Where is your "getsquadrondb()" function? Have you made it? Link to comment https://forums.phpfreaks.com/topic/117922-it-appears-that-my-function-is-ill-defined-help/#findComment-606561 Share on other sites More sharing options...
Chezshire Posted August 3, 2008 Author Share Posted August 3, 2008 Thank you ProjectFear, It was so late and I was so not thinking think. I do not have a getSquardonDB function written in my functions.php file. I will check that and if that is the case I will write that and take things from there - THANK YOU! Link to comment https://forums.phpfreaks.com/topic/117922-it-appears-that-my-function-is-ill-defined-help/#findComment-606656 Share on other sites More sharing options...
Chezshire Posted August 4, 2008 Author Share Posted August 4, 2008 Hello All, thanks to Project Fears keen senses, I realized my first dumb mistake and was able to resolve it (thanks to the bid dawg!). Now I almost have my little silly project finished, right now my squad names are displaying as numbers (the names are assigned via an array - Alpha, Beta, Delta, Gamma, etc). I want the them to display as the names rather then the number values which are stored in the database/functions array. Can anyone help me to figure this out? thanks as always -- below is my code: <?php //title echo "<br>\n<h2><font color='#A5B9D5'>TRAINING SQUADRONS</font></h2>\n"; //get characters by squadron $sql = "SELECT id, squadronDB, codename FROM cerebra ORDER BY squadronDB"; $result = mysql_query($sql) or trigger_error(mysql_error,E_USER_ERROR); while($row = mysql_fetch_assoc($result)){ //here's the key. Use a while loop to repeat through the code $thisID = $codename["id"]; $squadronDB = getSquad($thisID); $squadronDB = getChar($char_ID); // start character div echo '<div style="float: left; padding-top: 5; width: 220;">'; echo "<span class='fineprint'>"; // makes thin bar echo '<hr align="centered" color="#050F1D" size="2" width="66%">'; // image div echo '<div style="float: left; padding-left: 5;"><img src="/cerebra/images/'.$row['id'].'-.jpg" width="60" height="75" border="2px" bordercolor="#415582"></div>'; // name div // styles echo '<div style="float: left; vertical-align: top; padding-left: 5;"><p>'; // span and model name echo '<span class="fineprint"><i>'.$row['squadronDB']; // link and codename echo ' <br>as <a href="/cerebra/display.php?id='.$row['id'].'">'.$row['codename'].'</a></i></span></p></div>'; // end character div echo '</div>'; //these two lines (or any lines up to the closing brace) will be repeated for each row returned by the query } ?> Link to comment https://forums.phpfreaks.com/topic/117922-it-appears-that-my-function-is-ill-defined-help/#findComment-607103 Share on other sites More sharing options...
MasterACE14 Posted August 4, 2008 Share Posted August 4, 2008 whats your problem now exactly? Link to comment https://forums.phpfreaks.com/topic/117922-it-appears-that-my-function-is-ill-defined-help/#findComment-607115 Share on other sites More sharing options...
Chezshire Posted August 4, 2008 Author Share Posted August 4, 2008 Hello MasterAce14, I am very much the novice so please forgive me if i do not explain things correctly -(i'm using PHP for dummies and still teaching myself). Since asking here, I've been looking through google and I think that what I want to do is a Switch structure? If you go to http://www.xpg.us/institute/institute1.3.php, you'll see that the names of the squardon's appear as numbers rather then as their names. I want to not list anyone who has a 0, and then to list anyone with a 1, 2, 3 or 4 as Alpha Squad, 5, 6, 7, or 8 as Beta Squad, 9, 10, 11, or 12 as Delta Squad, etc. essentially i want to list groups based on sequential numerical sequences by their names. Thus Character A who is a '0' would not be listed at all, but Character 'B' who is a '2' would be listed as a member of 'Alpha Squad' in stead of as '2'. this is the code again: <?php //title echo "<br>\n<h2><font color='#A5B9D5'>TRAINING SQUADRONS</font></h2>\n"; //get characters by squadron $sql = "SELECT id, squadronDB, codename FROM cerebra ORDER BY squadronDB"; $result = mysql_query($sql) or trigger_error(mysql_error,E_USER_ERROR); while($row = mysql_fetch_assoc($result)){ //here's the key. Use a while loop to repeat through the code $thisID = $codename["id"]; $squadronDB = getSquad($thisID); $squadronDB = getChar($char_ID); // start character div echo '<div style="float: left; padding-top: 5; width: 220;">'; echo "<span class='fineprint'>"; // makes thin bar echo '<hr align="centered" color="#050F1D" size="2" width="66%">'; // image div echo '<div style="float: left; padding-left: 5;"><img src="/cerebra/images/'.$row['id'].'-.jpg" width="60" height="75" border="2px" bordercolor="#415582"></div>'; // name div // styles echo '<div style="float: left; vertical-align: top; padding-left: 5;"><p>'; // span and model name echo '<span class="fineprint"><i>'.$row['squadronDB']; // link and codename echo ' <br>as <a href="/cerebra/display.php?id='.$row['id'].'">'.$row['codename'].'</a></i></span></p></div>'; // end character div echo '</div>'; //these two lines (or any lines up to the closing brace) will be repeated for each row returned by the query } ?> Link to comment https://forums.phpfreaks.com/topic/117922-it-appears-that-my-function-is-ill-defined-help/#findComment-607134 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.