Jump to content

Recommended Posts

I dont know why :(

 

<?php

$sql="SELECT id,Playername,Password,Description,Points,AcademyLevel,Money,Status,Girlscout,gold,diploma,lastlog,Ad,Email,organize,upness FROM player WHERE id='$id'";
$result=mysql_query($sql);

while($r=mysql_fetch_array($result));
{	

$id=$r["id"];
$Playername=$r["Playername"];
$Password=$r["Password"];
$Description=$r["Description"];
$Points=$r["Points"];
$AcademyLevel=$r["AcademyLevel"];
$Money=$r["Money"];
$Status=$r["Status"];
$GirlScout=$r["GirlScout"];
$gold=$r["gold"];
$diploma=$r["diploma"];
$lastlog=$r["lastlog"];
$Ad=$r["Ad"];
$Email=$r["Email"];
$organize=$r["organize"];
$upness=$r["upness"];

if($organize){
$addon=" ORDER BY $organize $upness";
}

if($pid == "$id"){
if($_GET['sortby']){
$sortby=$_GET['sortby'];
if($_GET['order']){
$order=$_GET['order'];
mysql_query("update player set organize='$sortby',upness='$order' where id='$id'");
print "Successfully edited the organization of your horses.";
include "footer.php";
exit;
}
print "How would you like to sort the horse's <b>$sortby</b> on your page? By:<p><a href='player_estate.php?sortby=$sortby&order=ASC'>Ascending</a><br><a href='player_estate.php?sortby=$sortby&order=DESC'>Descending</a>";
include "footer.php";
exit;
}
}

if($_GET[action] == "changepassword2"){
if($_POST[oldpass] != $Passwordd){print "Wrong old password."; include "footer.php"; exit;}
mysql_query("update player set Password='$_POST[newpassword]' where id='$id'");

print "<font color=red>You changed your password.</font> You have been signed out for verification. <a href=index.php> Click here to sign back in.</a><br><br>"; include 'footer.php'; exit;}
if($_GET[action] == "changepassword1"){PRINT "
<form method=post action=player_estate.php?action=changepassword2>
Old Pass:<input type=text name='oldpass'><br>
New Pass:<input type=text name='newpassword'><br>
<input type=submit value='Change Pass'></form>";
}



echo "<font size='5pt' face='comic sans ms'>Welcome to Your Estate $Playername!</font><BR> You Are ID #$id <br><br><br> $Description <br><BR><br>";
}
?>

Link to comment
https://forums.phpfreaks.com/topic/158304-mysql-array-not-working/
Share on other sites

Is there a possibility that you aren't setting $id correctly? You may wish to echo $sql to find out what the SELECT statement looks like. If you have access to something like phpMyAdmin, you could do what I often do, which is grab that select statement that you just echoed and try it in phpMyAdmin.

 

Another possibility is that one of your fields is a reserved keyword for mysql. I often hedge against that by using back-quotes (` - usually under the tilda on your keyboard) around all fieldnames (ie `id`,`Playername`,`Password` ...).

 

Other than that, more info on what you're experiencing would be helpful.

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

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.