Jump to content

[SOLVED] Help: 'Wrong datatype for second argument in... line 172'


Chezshire

Recommended Posts

I'm trying to build an array (I believe that that is what it is called) which will display all of the characters who correspond to one of the particular values of the array ("ALPHA - Alpha Flight (Advisor)", "ALPHA - Alpha Flight (Field Leader)",... etc./all") I am currently googling and playing with the code to figure out what the problem is (but i'm dealing brain cancer and i'm dyslexic so any help and or guidance is appreciated.) Thanks for any help anyone is willing to offer. I am also a complete novice who is trying to learn php on the fly as a form of taking my mind off of my cancer - which is going really well!

 

Thank you everyone and happy 4th to all of the people in the USA

Chez

 

 

 

the line in question #172:

$key = array_search($thisSquad, $squad);

 

full section of code in question:

// SQUADRONS

$sql = "SELECT id, squadronDB FROM cerebra WHERE approved=\"true\" AND squadronDB IS NOT NULL AND squadronDB != \"\" AND type=\"student\" AND player > 0";
$result = mysql_query($sql);

$squadronDB = array("ALPHA - Alpha Flight (Advisor)",
"ALPHA - Alpha Flight (Field Leader)", "ALPHA - Alpha Flight (Deputy Leader)",
"ALPHA - Alpha Flight", "BETA - Buckaroo Banzias (Advisor)", "BETA - Buckaroo Banzias (Field Leader)", "BETA - Buckaroo Banzias (Deputy Leader)", "BETA - Buckaroo Banzias", "KAPPA - Corsairs (Advisor)", "KAPPA - Corsairs (Field Leader)", "KAPPA - Corsairs (Deputy Leader)", "KAPPA - Corsairs", "DELTA - Paragons (Advisor)", "DELTA - Paragons (Field Leader)", "DELTA - Paragons (Deputy Leader)", "DELTA - Paragons", "EPSILON - Excaliber (Advisor)", "EPSILON - Excaliber (Field Leader)", "EPSILON - Excaliber (Deputy Leader)", "EPSILON - Excaliber", "OMEGA - Omega Gang (Advisor)", "OMEGA - Omega Gang (Field Leader)", "OMEGA - Omega Gang (Deputy Leader)", "OMEGA - Omega Gang",);

$squadders = array();

WHILE ($squadder = mysql_fetch_assoc($result)) {
$tempSquad = explode("^", $squadders["TRAINING SQUADRONS"]);

foreach ($tempSquad as $thisSquad) {

$key = array_search($thisSquad, $squad);

if ($key) {
if (!isset($squadders[$key])) { $squadders[$key] = array(); }
array_push($squadders[$key], $squadder["id"]);
} // end if in club list

} // end foreach

} // end WHILE

$col = 0;

echo "<br>\n<h2><font color='#A5B9D5'>TRAINING SQUADRONS</font></h2>\n";

echo "<hr color='#050F1D' size='5'>\n";

echo "<table cellpadding='0'><tr>";
for ($i =0; $i < count($squad); $i++) {

if (isset($squadders[$i])) {
if ($col == 0) { echo "<td valign='top'>"; }
echo "<p><b>$squad[$i]</b><br>\n";
foreach ($squadders[$i] as $thisSquadder) {
$safeName = preg_replace("/\"/", """, getChar($thisSquadder));
$realName = getRealName($thisSquadder);
if ($realName == "(Unrevealed)") { $realName = $safeName; }
echo "<span class='fineprint'><a href=\"/cerebra/display.php?id=$thisSquadder\" title=\"$safeName\">$realName</a></span><br>\n"; }
echo "</p>\n";
$col++;
if ($col == 4) { echo "</td><td width='25'></td>\n"; $col=0; }
} // end if any students in this club

} // end for

IF ($col < 4) { echo "</td>"; }

echo "</tr></table>\n";
?>

</TD>
</TR>

</TABLE>

</DIV>


<?php 
include("../mods.php"); 
include("../footer.php"); 
?>

 

THank you for your guidance and help Ratcatme!

 

I found that on fifth line of my code, i had titled the array '$squadronDB = array....'. I changed this to $squad and the error went away! Sadly nothing happened beyond the display of the category name. Do you or anyone else have any suggestions or should i mark this as solved as my problem was solved even if I am now faced with a larger mystery?

 

thanks Ratcatme!!!!!

Thank you Darkfreaks - I place the line to check as you suggested but no errors were returned.

That said i thought i figured out the problem but i didn't. I'm going to list this topic as solved, as the problem i had was. I now have a new problem and i want to thank those who've helped me get through what would have undoubtedly taken me days to get too! Thank you as always PHPfreaks!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.