Jump to content
MakeWebGames

Recommended Posts

Posted

In my attempt to reduce server load im now down to my last issue. I have a few things that are loaded via the header thus every page load a query is loaded per addional info.

 

I wanting to get this information updated via the use of sessions but unsure how to go about it.

 

Here is 1 or the queries that load.

 

 

$fivgz=$db->query("SELECT gangNAME, gangID FROM gangs ORDER BY gangRESPECT DESC LIMIT 3");

while($r=$db->fetch_row($fivgz))

{

print "[size=1]<a href='gangs.php?action=view&ID={$r['gangID']}'>{$r['gangNAME']}<a>

[/size]";[code]

 

Im still unsure if the limits regarding sessions and the like.

 

How would you session this. I have the updates part sorted as per the help from fbiss on a past post however im stuck on this. The main reason is the query pulling a limit 3. All my attempts have failed with just showing one session result and not the 3 that are required.

 

Many thanks in advance for any help.

Posted

you could do something like this

if (!isset($_SESSION['uGang'])) {
$fivgz=$db->query("SELECT gangNAME, gangID FROM gangs ORDER BY gangRESPECT DESC LIMIT 3");
while($r=$db->fetch_row($fivgz))
{
$_SESSION['uGang'] = "[size="1"]<a href='gangs.php?action=view&ID={$r['gangID']}'>{$r['gangNAME']}<a>
[/size]";}
} else {echo $SESSION['uGANG'];}

this probly can be done a better (more secure way ... not sure im no hacker but your storing html data then echo'in it so i spose there is an issue there)

please note this may not work, i did itwhile on break at work on a dogey keyboard

Posted

try this then

$_SESSION['uGang']='';
if (!isset($_SESSION['uGang'])) {
$fivgz=$db->query("SELECT gangNAME, gangID FROM gangs ORDER BY gangRESPECT DESC LIMIT 3");
while($r=$db->fetch_row($fivgz))
{
$_SESSION['uGang'] =$_SESSION['uGang']."[size="1"]<a href='gangs.php?action=view&ID={$r['gangID']}'>{$r['gangNAME']}<a>
[/size]";}
} else {echo $_SESSION['uGANG'];}
Posted
try this then
 
$_SESSION['uGang']=''; 
if (!isset($_SESSION['uGang'])) { 
$fivgz=$db->query("SELECT gangNAME, gangID FROM gangs ORDER BY gangRESPECT DESC LIMIT 3"); 
while($r=$db->fetch_row($fivgz)) 
{ 
$_SESSION['uGang'] =$_SESSION['uGang']."{$r['gangNAME']} 
";} 
} else {echo $_SESSION['uGANG'];}

thats going to make it never use the Session

Try this

 

 
if (empty($_SESSION['topgangs'])) {
$_SESSION['topgangs']=''; 
$fivgz=$db->query("SELECT gangNAME, gangID FROM gangs ORDER BY gangRESPECT DESC LIMIT 3"); 
while($r=$db->fetch_row($fivgz)) 
{ 
 $_SESSION['topgangs'].= "[size="1"]<a href='gangs.php?action=view&ID={$r['gangID']}'>{$r['gangNAME']}<a>[/size]
";
} 
} 
echo $_SESSION['topgangs'];
Posted

Gee ive tried every example on here and not one has worked. Please test before posting to ensure it works. If any example here does work then please say so as it then could be a fault my end.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...