adding mysql values
Code: Select all
name points posts
x 10 30
y 50 13
z 100 16A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
name points posts
x 10 30
y 50 13
z 100 16Code: Select all
<?PHP
// connect code
$getallpoints = mysql_query("SELECT SUM(points) AS totalpoints FROM users") ;
$points = mysql_result($getallpoints, 'totalpoints', 0) ;
echo $points ;
?>Code: Select all
<?PHP
// connect code
$getallpoints = mysql_query("e;SELECT SUM(points) AS totalpoints FROM users"e;) ;
$points = mysql_result($getallpoints, 'totalpoints', 0u started at leastCode: Select all
<?PHP
// connect code
$getallpoints = mysql_query("SELECT SUM(points) AS totalpoints FROM users") ;
$points = mysql_result($getallpoints, 'totalpoints', 0) ;
echo $points ;
?>Code: Select all
<?PHP
// connect code
$getallpoints = mysql_query("SELECT SUM(points) AS totalpoints FROM users") ;
$points = mysql_result($getallpoints, 'totalpoints', 0) ;
echo $points ;
?>Code: Select all
<?PHP
// connect code
$getallpoints = mysql_query("SELECT SUM(points) AS totalpoints FROM users") ;
$points = mysql_result($getallpoints, 'totalpoints', 0) ;
echo $points ;
?>Code: Select all
<?PHP
// connect code
$getallpoints = mysql_query("SELECT SUM(points) AS totalpoints FROM users") ;
$points = mysql_result($getallpoints, 'totalpoints', 0) ;
echo $points ;
?>Code: Select all
<?PHP
// connect code
$getallpoints = mysql_query("SELECT SUM(points) AS totalpoints FROM users") ;
$points = mysql_result($getallpoints, 'totalpoints', 0) ;
echo $points ;
?>
esult($getallpoints, 'totalpoints', 0) ;
echo $points ;
?>Code: Select all
<?PHP
// connect code
$getallpoints = mysql_query("SELECT SUM(points) AS totalpoints FROM users") ;
$points = mysql_result($getallpoints, 'totalpoints', 0) ;
echo $points ;
?>Code: Select all
<?PHP
// connect code
$getallpoints = mysql_query("SELECT SUM(points) AS totalpoints FROM users") ;
$points = mysql_result($getallpoints, 'totalpoints', 0) ;
echo $points ;
?&connect code
$getallpoints = mysql_query("SELECT SUM(points) AS totalpoints FROM users") ;
$points = mysql_result($getallpoints, 'totalpoints', 0) ;
echo $points ;
?>Code: Select all
<?PHP
// connect code
$getallpoints = mysql_query("SELECT SUM(points) AS totalpoints FROM users") ;
$points = mysql_result($getallpoints, 'totalpoints', 0) ;
echo $points ;
?>and all the other tables in my database are also namedabc, def, hij, klm
What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeabc, def, hij, klm
Code: Select all
<?php
$db = mysql_connect("localhost", "", "");
mysql_select_db("top50",$db);
$result = mysql_query("SELECT * FROM squads",$db);
while($row = mysql_fetch_assoc($result))
{
extract($row);
$getallkills = mysql_query("SELECT SUM(kills) AS totalkills FROM $squads");
$kills = mysql_result($getallkills, 'totalkills', 0);
echo "Kills ".$kills;
echo "<br>";
}
?>it should be something likeKills 250
Kills
Because there are 2 different $squads....if that made any sense what am i doing wrong?ts assume i have a database called top50, and in there there are multiple tables. One table called 'squads' which contains the names of every other table on the database. For example the table squads has the informationKills 250
Kills 100
and all the other tables in my database are also namedabc, def, hij, klm
What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeabc, def, hij, klm
Code: Select all
<?php
$db = mysql_connect("localhost", "", "");
mysql_select_db("top50",$db);
$result = mysql_query("SELECT * FROM squads",$db);
while($row = mysql_fetch_assoc($result))
{
extract($row);
$getallkills = mysql_query("SELECT SUM(kills) AS totalkills FROM $squads");
$kills = mysql_result($getallkills, 'totalkills', 0);
echo "Kills ".$kills;
echo "<br>";
}
?>and all the other tables in my database are also namedKills 250
Kills
, and in there there are multiple tables. One table called 'squads' which contains the names of every other table on the database. For example the table squads has the informationand all the other tables in my database are also namedabc, def, hij, klmWhat i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeabc, def, hij, klmCode: Select all
<?php $db = mysql_connect("e;localhost"e;, "e;"e;, "e;"e;); mysql_select_db("e;top50"e;,$db); $result = mysql_query("e;SELECT * FROM squads"e;,$db); while($row = mysql_fetch_assoc($result)) { extract($row); $getallkills = mysql_query("e;SELECT SUM(kills) AS totalkills FROM $squads"e;); $kills = mysql_result($getallkills, 'totalkills', 0); echo "e;Kills "e;.$kills; echo "e;<br>"e;; } ?&aalled 'squads' which contains the names of every other table on the database. For example the table squads has the information[quote]abc, def, hij, klm[/quote] and all the other tables in my database are also named [quote]abc, def, hij, klm[/quote] What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeWhen i run t tables. One table called 'squads' which contains the names of every other table on the database. For example the table squads has the informationCode: Select all
<?php $db = mysql_connect("e;localhost"e;, "e;"e;, "e;"e;); mysql_select_db("e;top50"e;,$db); $result = mysql_query("e;SELECT * FROM squads"e;,$db); while($row = mysql_fetch_assoc($result)) { extract($row); $getallkills = mysql_query("e;SELECT SUM(kills) AS totalkills FROM $squads"e;); $kills = mysql_result($getallkills, 'totalkills', 0); echo "e;Kills "e;.$kills; echo "e;<br>"e;; } ?>and all the other tables in my database are also namedabc, def, hij, klmWhat i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeabc, def, hij, klmCode: Select all
<?php $db = mysql_connect("localhost", "e;"e;, "e;"e;); mysql_select_db("e;top50"e;,$db); $result = mysql_query("e on to the next step. Now lets assume i have a database called top50, and in there there are multiple tables. One table called 'squads' which contains the names of every other table on the database. For example the table squads has the information[quote]abc, def, hij, klm[/quote] and all the other tables in my database are also named [quote]abc, def, hij, klm[/quote] What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeWhen i run that it displays thisCode: Select all
<?php $db = mysql_connect("e;localhost"e;, "e;"e;, "e;"e;); mysql_select_db("e;top50"e;,$db); $result = mysql_query("e;SELECT * FROM squads"e;,$db); while($row = mysql_fetch_assoc($result)) { extract($row); $getallkills = mysql_query("e;SELECT SUM(kills) AS totalkills FROM $squads"e;); $kills = mysql_result($getallkills, 'totalkills', 0); echo "e;Kills "e;.$kills; echo "e;<br>"e;; } ?>
it should be something likeKills 250
KillsBecause there are 2 differ on to the next step.Kills 250
Kills 100
Now lets assume i have a database called top50, and in there there are multiple tables. One table called 'squads' which contains the names of every other table on the database. For example the table squads has the informationand all the other tables in my database are also namedabc, def, hij, klmWhat i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeabc, def, hij, klmWhen i run that it displays thisCode: Select all
<?php $db = mysql_connect("localhost", "", ""); mysql_select_db("top50",$db); $result = mysql_query("SELECT * FROM squads",$db); while($row = mysql_fetch_assoc($result)) { extract($row); $getallkills = mysql_query("SELECT SUM(kills) AS totalkills FROM $squads"); $kills = mysql_result($getallkills, 'totalkills', 0); echo "Kills ".$kills; echo "<br>"; } ?>
it should be something likeKills 250
KillsBecause there are 2 different $squads....if that made any sense what am i doing wrong?phpKills 250
Kills 100
$db = mysql_connect("localhost", "", "");
mysql_select_db("top50",$db);
$result = mysql_query("SELECT * FROM squads",$db);
while($row = mysql_fetch_assoc($result))
{
extract($row);
$getallkills = mysql_query("SELECT SUM(kills) AS totalkills FROM $squads");
$kills = mysql_result($getallkills, 'totalkills', 0);
echo "Kills ".$kills;
echo "<br>";
}
?>
When i run that it displays this
it should be something likeKills 250
KillsBecause there are 2 different $squads....if that made any sense what am i doing wrong?ow = mysql_fetch_assoc($result))Kills 250
Kills 100
{
extract($row);
$getallkills = mysql_query("SELECT SUM(kills) AS totalkills FROM $squads");
$kills = mysql_result($getallkills, 'totalkills', 0);
echo "Kills ".$kills;
echo "<br>";
}
?>
When i run that it displays this
it shoul0, and in there there are multiple tables. One table called 'squads' which contains the names of every other table on the database. For example the table squads has the informationKills 250
Killsand all the other tables in my database are also namedabc, def, hij, klmWhat i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeabc, def, hij, klmCode: Select all
<?php $db = mysql_connect("localhost", "", ""); mysql_select_db("top50",$db); $result = mysql_queryre multiple tables. One table called 'squads' which contains the names of every other table on the database. For example the table squads has the information[quote]abc, def, hij, klm[/quote] and all the other tables in my database are also named [quote]abc, def, hij, klm[/quote] What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeCode: Select all
<?php $db = mysql_connect("e;localhost"e;, "e;"e;, "e;"e;); mysql_select_db("e;top50"e;,$db); $result = mysql_query("e;SELECT * FROM squads"e;,$db); while($row = mysql_fetch_assoc($result)) { extract($row); $getallkills = mysql_query("e;SELECT SUM(kills) AS totalkills FROM $squads"e;); $kills = mysql_result($getalle i have a database called top50, and in there there are multiple tables. One table called 'squads' which contains the names of every other table on the database. For example the table squads has the information[quote]abc, def, hij, klm[/quote] and all the other tables in my database are also named [quote]abc, def, hij, klm[/quote] What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeCode: Select all
<?php $db = mysql_connect("localhost", "", ""); mysql_select_db("top50",$db); $result = mysql_query("SELECT * FROM squads",$db); while($row = mysql_fetch_assoc($result)) { extract($row); $getallkills = mysql_query("SELECT SUM(kills) AS totalkills FROM $squads"); $kills = mysql_result($getallkills, 'totalkills', 0); echo "Kills ".$kills; echo &quo database. For example the table squads has the information[quote]abc, def, hij, klm[/quote] and all the other tables in my database are also named [quote]abc, def, hij, klm[/quote] What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeWhen i run that it displays thisCode: Select all
<?php $db = mysql_connect("e;localhost"e;, "e;"e;, "e;"e;); mysql_select_db("e;top50"e;,$db); $result = mysql_query("e;SELECT * FROM squads"e;,$db); while($row = mysql_fetch_assoc($result)) { extract($row); $getallkills = mysql_query("e;SELECT SUM(kills) AS totalkills FROM $squads"e;); $kills = mysql_result($getallkills, 'totalkills', 0); echo "e;Kills "e;.$kills; echo "e;<br>"e;; } ?>
it should be something likeKills 250
KillsBecaus namedKills 250
Kills 100What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeabc, def, hij, klmCode: Select all
<?php $db = mysql_connect("localhost", "", ""); mysql_select_db("top50",$db); $result = mysql_query("SELECT * FROM squads",$db); while($row = mysql_fetch_assoc($result)) { extract($row); $getallkills = mysql_qxt step. Now lets assume i have a database called top50, and in there there are multiple tables. One table called 'squads' which contains the names of every other table on the database. For example the table squads has the information[quote]abc, def, hij, klm[/quote] and all the other tables in my database are also named [quote]abc, def, hij, klm[/quote] What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeWhen i run that it displays thisCode: Select all
<?php $db = mysql_connect("localhost", "", ""); mysql_select_db("top50",$db); $result = mysql_query("SELECT * FROM squads",$db); while($row = mysql_fetch_assoc($result)) { extract($row); $getallkills = mysql_query("SELECT SUM(kills) AS totalkills FROM $squads"); $kills = mysql_result($getallkills, 'totalkills', 0); echo "Kills ".$kills; echo "<br>"; } ?>
it should be something likeKills 250
KillsBecause there are 2 different $squads....if that made any sense what am i doing wrong?uote]abc, def, hij, klmKills 250
Kills 100
What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeabc, def, hij, klm
Code: Select all
<?php
$db = mysql_connect("localhost", "", "");
mysql_select_db("top50",$db);
$result = mysql_query("SELECT * FROM squads",$db);
while($row = mysql_fetch_assoc($result))
{
extract($row);
$getallkills = mysql_query("SELECT SUM(kills) AS totalkills FROM $squads");
$kills = mysql_result($getallkills, 'totalkills', 0);
echo "Kills ".$kills;
echo "<br>";
}
?>it should be something likeKills 250
Kills
Because there are 2 different $squads....if that made any sense]abc, def, hij, klm[/quote]Kills 250
Kills 100
Code: Select all
<?php
$db = mysql_connect("localhost", "", "");
mysql_select_db("top50",$db);
$result = mysql_query("SELECT * FROM squads",$db);
while($row = mysql_fetch_assoc($result))
{
extract($row);
$getallkills = mysql_query("SELECT SUM(kills) AS totalkills FROM $squads");
$kills = mysql_result($getallkills, 'totalkills', 0);
echo "Kills ".$kills;
echo "<br>";
}
?>it should be something likeKills 250
Kills
Because there are 2 different $squads....if that made any sense what am i doing wrong?mysql_query("SELECT * FROM squads",$db);Kills 250
Kills 100
it should be something likeKills 250
Kills
Because there are 2 different $squads....if that made any sense what am i doing wrong?or example the table squads has the informationKills 250
Kills 100
and all the other tables in my database are also namedabc, def, hij, klm
What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeabc, def, hij, klm
Code: Select all
<?php
$db = mysql_connect("localhost", "", "");
mysql_select_db("top50",$db);
$result = mysql_query("SELECT * FROM squads",$db);
while($row = mysql_fetch_assoc($result))
{
extract($row);
$getallkills = mysql_query("SELECT SUM(kills) AS totalkills FROM $squads");
$kills = mysql_result($getallkills, 'totalkills', 0);
echo "Kills ".$kills;
echo "<br>";
}
?>and all the other tables in my database are also namedKills 250
Kills
hij, klm
What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeabc, def, hij, klm
Code: Select all
<?php
$db = mysql_connect("localhost", "", "");
mysql_select_db("top50",$db);
$result = mysql_query("SELECT * FROM squads",$db);
while($row = mysql_fetch_assoc($result))
{
extract($row);
$getallkills = mysql_query("e;SELECT SUM(kills) AS totalkills FROM $squads"e;);
$kills = mysql_result($getallkills, 'totalkills', 0);
echo "e;Kills "e;.$kills;Code: Select all
<?php
$db = mysql_connect("localhost", "", "");
mysql_select_db("top50",$db);
$result = mysql_query("SELECT * FROM squads",$db);
while($row = mysql_fetch_assoc($result))
{
extract($row);
$getallkills = mysql_query("SELECT SUM(kills) AS totalkills FROM $squads");
$kills = mysql_result($getallkills, 'totalkills', 0);
echo "Kills ".$kills;
echo "<br>";
}
?>and all the other tables in my database are also namedabc, def, hij, klm
What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeabc, def, hij, klm
Code: Select all
<?php
$db = mysql_connect("localhost", "", "");
mysql_select_db("top50",$db);
$result = mysql_query("SELECT * FROM squads"e;,$db);
while($row = mysql_fetch_assoc($result))
{
extract($row);
$getallkills = mysql_query("e;SELECT SUM(kills) AS totalkills FROM $squads"e;);
$kills = mysql_result($getallkills, 'totalkills', 0);
echo "e;Ki want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeCode: Select all
<?php
$db = mysql_connect("localhost", "", "");
mysql_select_db("top50",$db);
$result = mysql_query("SELECT * FROM squads",$db);
while($row = mysql_fetch_assoc($result))
{
extract($row);
$getallkills = mysql_query("SELECT SUM(kills) AS totalkills FROM $squads");
$kills = mysql_result($getallkills, 'totalkills', 0);
echo "Kills ".$kills;
echo "<br>";
}
?>it should be something likeKills 250
Kills
Because there are 2 different $squads....if that made any sense what am i doing wrong?lets assume i have a database called top50, and in there there are multiple tables. One table called 'squads' which contains the names of every other table on the database. For example the table squads has the informationKills 250
Kills 100
and all the other tables in my database are also namedabc, def, hij, klm
What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeabc, def, hij, klm
Code: Select all
<?php
$db = mysql_connect("localhost", "", "");
mysql_select_db("top50",$db);
$result = mysql_query("SELECT * FROM squads",$db);
while($row = mysql_fetch_assoc($result))
{
extract($row);
$getallkills = mysql_query("SELECT SUM(kills) AS totalkills FROM $squads");
$kills = mysql_result($getallkills, 'totalkills', 0);
echo "Kills ".$kills;
echo "<br>";
}
?>it should be something likeKills 250
Kills
Because there are 2 differother table on the database. For example the table squads has the informationKills 250
Kills 100
and all the other tables in my database are also namedabc, def, hij, klm
What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeabc, def, hij, klm
Code: Select all
<?php
$db = mysql_connect("localhost", "", "");
mysql_select_db("top50",$db);
$result = mysql_query("SELECT * FROM squads",$db);
while($row = mysql_fetch_assoc($result))
{
extract($row);
$getallkills = mysql_query("SELECT SUM(kills) AS totalkills FROM $squads");
$kills = mysql_result($getallkills, 'totalkills', 0);
echo "Kills ".$kills;
echo "<br>";
}
?>it should be something likeKills 250
Kills
Because there are 2 different $squads....if that made any sense what am i doing wrong?w lets assume i have a database called top50, and in there there are multiple tables. One table called 'squads' which contains the names of every other table on the database. For example the table squads has the informationKills 250
Kills 100
and all the other tables in my database are also namedabc, def, hij, klm
What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeabc, def, hij, klm
Code: Select all
<?php
$db = mysql_connect("localhost", "", "");
mysql_select_db("top50",$db);
$result = mysql_query("SELECT * FROM squads",$db);
while($row = mysql_fetch_assoc($result))
{
extract($row);
$getallkills = mysql_query("SELECT SUM(kills) AS totalkills FROM $squads");
$kills = mysql_result($getallkills, 'totalkills', 0);
echo "Kills ".$kills;
echo "<br>";
}
?>and all the other tables in my database are also namedabc, def, hij, klm
What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeabc, def, hij, klm
Code: Select all
<?php
$db = mysql_connect("e;localhost"e;, "", "");
mysql_select_db("top50",$db);
$result = mysql_query("e;SELECT * FROM squads"e;,$db);
while($row = mysql_fetch_assoc($result))
{
ese. For example the table squads has the information[quote]abc, def, hij, klm[/quote]
and all the other tables in my database are also named [quote]abc, def, hij, klm[/quote]
What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeCode: Select all
<?php
$db = mysql_connect("e;localhost"e;, "e;"e;, "e;"e;);
mysql_select_db("e;top50"e;,$db);
$result = mysql_query("e;SELECT * FROM squads"e;,$db);
while($row = mysql_fetch_assoc($result))
{
extract($row);
$getallkills = mysql_query("e;SELECT SUM(kills) AS totalkills FROM $squads"e;);
$kills = mysql_result($getallkills, 'totalkills', 0);
echo "e;Kills "e;.$kills;
echo "e;<br>"e;;
}
?>it should be something likeKills 250
Kills
What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeKills 250
Kills 100[/quote is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeCode: Select all
<?php $db = mysql_connect("e;localhost", "", ""); mysql_select_db("top50",$db); $result = mysql_query("SELECT * FROM squads",$db); while($row = mysql_fetch_assoc($result)) { extract($row); $getallkills = mysql_query("e;SELECT SUM(kills) AS totalkilare also named [quote]abc, def, hij, klm[/quote] What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeCode: Select all
<?php $db = mysql_connect("localhost", "", ""); mysql_select_db("top50",$db); $result = mysql_query("SELECT * FROM squads",$db); while($row = mysql_fetch_assoc($reere are multiple tables. One table called 'squads' which contains the names of every other table on the database. For example the table squads has the information[quote]abc, def, hij, klm[/quote] and all the other tables in my database are also named [quote]abc, def, hij, klm[/quote] What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeWhen i run that it displays thisCode: Select all
<?php $db = mysql_connect("localhost", "", ""); mysql_select_db("top50",$db); $result = mysql_query("SELECT * FROM squads",$db); while($row = mysql_fetch_assoc($result)) { extract($row); $getallkills = mysql_query("SELECT SUM(kills) AS totalkills FROM $squads"); $kills = mysql_result($getallkills, 'totalkills', 0); echo "Kills ".$kills; echo "<br>"; } ?>
it should be something likeKills 250
KillsBecause there are 2 different $squads....if that made any sense what am i doing wrong? step.Kills 250
Kills 100
Now lets assume i have a database called top50, and in there there are multiple tables. One table called 'squads' which contains the names of every other table on the database. For example the table squads has the informationand all the other tables in my database are also namedabc, def, hij, klmWhat i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeabc, def, hij, klmWhen i run that it displays thisCode: Select all
<?php $db = mysql_connect("localhost", "", ""); mysql_select_db("top50",$db); $result = mysql_query("SELECT * FROM squads",$db); while($row = mysql_fetch_assoc($result)) { extract($row); $getallkills = mysql_query("SELECT SUM(kills) AS totalkills FROM $squads"); $kills = mysql_result($getallkills, 'totalkills', 0); echo "Kills ".$kills; echo "<br>"; } ?>
it should be something likeKills 250
KillsBecause there are 2 different $squads....if that made any sense what am i doing wrong? def, hij, klmKills 250
Kills 100
Code: Select all
<?php
$db = mysql_connect("e;localhost"e;, "e;"e;, "e;");
mysql_select_db("top50",$db);
$result = my on to the next step.
Now lets assume i have a database called top50, and in there there are multiple tables. One table called 'squads' which contains the names of every other table on the database. For example the table squads has the information[quote]abc, def, hij, klm[/quote]
and all the other tables in my database are also named [quote]abc, def, hij, klm[/quote]
What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeCode: Select all
<?php
$db = mysql_connect("e;localhost"e;, "e;"e;, "e;"e;);
mysql_select_db("e;top50"e;,$db);
$result = mysql_query("e;SELECT * FROM squads"e;,$db);
while($row = mysql_fetch_assoc($result))
{
extract($row);
$getallkills = mysql_query("e;SELECT SUM(kills) AS totalkills FROM $squads"e;);
$kills = mysql_result($getallkills, 'totalkills', 0);
echo "e;Kills "e;.$kills;
echo "e;<br>"e;;
}
?>it should be something likeKills 250
Kills
Because tabase. For example the table squads has the informationKills 250
Kills 100
and all the other tables in my database are also namedabc, def, hij, klm
What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeabc, def, hij, klm
Code: Select all
<?php
$db = mysql_connect("e;localhost"e;, "e;"e;, "e;"e;);
mysql_select_db("e;top50"e;,$db);
$result = mysql_query("e;SELECT * FROM squads"e;,$db);
while($row = mysql_fetch_assoc($result))
{
extract($row);
$getallkills = mysql_query("e;SELECT SUM(kills) AS totalkills FROM $squads"e;);
$kills = mysql_result($getallkills, 'totalkills', 0);
echo &amdatabase called top50, and in there there are multiple tables. One table called 'squads' which contains the names of every other table on the database. For example the table squads has the information[quote]abc, def, hij, klm[/quote]
and all the other tables in my database are also named [quote]abc, def, hij, klm[/quote]
What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeCode: Select all
<?php
$db = mysql_connect("e;localhost"e;, "e;"e;, "e;"e;);
mysql_select_db("e;top50"e;,$db);
$result = mysql_query("e;SELECT * FROM squads"e;,$db);
while($row = mysql_fetch_assoc($result))
{
extract($row);
$getallkills = mysql_query("e;SELECT SUM(kills) AS totalkills FROM $squads"e;);
$kills = mysql_result($getallkills, 'totalkills', 0);
echo "e;Kills "e;.$kills;
echo "e;<br>"e;;
}
?>it should be something likeKills 250
Kills
Because there are 2 different $squads....if that made any sense what am i doing wrongf every other table on the database. For example the table squads has the informationKills 250
Kills 100
and all the other tables in my database are also namedabc, def, hij, klm
What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeabc, def, hij, klm
Code: Select all
<?php
$db = mysql_connect("localhost", "", "");
mysql_select_db("top50",$db);
$result = mysql_query("SELECT * FROM squads",$db);
while($row = mysql_fetch_assoc($result))
{
extract($row);
$getallkills = mysql_query("SELECT SUM(kills) AS totalkills FROM $squads");
$kills = mysql_result($getallkills, 'totalkills', 0);
echo "Kills ".$kills;
echo "<br>";
}
?>it should be something likeKills 250
Kills
Because there are 2 different $squads....if that made any sense what am i doing wrong? on to the next step.Kills 250
Kills 100
and all the other tables in my database are also namedabc, def, hij, klm
What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeabc, def, hij, klm
Code: Select all
<?php
$db = mysql_connect("localhost", "", "");
mysql_select_db("top50",$db);
$result = mysql_query("SELECT * FROM squads",$db);
while($row = mysql_fetch_assoc($result))
{
extract($row);
$getallkills = mysql_query("SELECT SUM(kills) AS totalkills FROM $squads");
$kills = mysql_result($getallkills, 'totalkills', 0);
echo "Kills ".$kills;
echo "<br>";
}
?>it should be somethiner table on the database. For example the table squads has the informationKills 250
Kills
and all the other tables in my database are also namedabc, def, hij, klm
What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeabc, def, hij, klm
Code: Select all
<?php
$db = mysql_connect("localhost", "", "");
mysql_select_db("top50",$db);
$result = mysql_query("SELECT * FROM squads",$db);
while($row = mysqlh contains the names of every other table on the database. For example the table squads has the information[quote]abc, def, hij, klm[/quote]
and all the other tables in my database are also named [quote]abc, def, hij, klm[/quote]
What i want to do is use $squads to query the database...the code i have partially works but it only displays one piece of information...here is my codeCode: Select all
<?php
$db = mysql_connect("localhost", "", "");
mysql_select_db("top50",$db);
$result = mysql_query("SELECT * FROM squads"e;,$db);
while($row = mysql_fetch_assoc($result))
{
extract($row);
$getallkills = mysql_query("e;SELECT SUM(kills) AS totalkills FROM $squads"e;);
$kills = mysql_result($getallkills, 'totalkills', 0);
echo "e;Kills "e;.$kills;
echo "e;<br>"e;;
}
?>it should be something likeKills 250
Kills
Because there are 2 different $squads....if that made any sense what am i doing wrong?Kills 250
Kills 100
Code: Select all
$getallkills = mysql_query("SELECT SUM(kills) AS totalkills FROM $squads");
// loop through results
while($array = mysql_fetch_assoc($getallkills)
{
$kills = $getallkills['totalkills'];
echo "Kills ".$kills;echo "<br>";
}