Note that there are some explanatory texts on larger screens.

plurals
  1. POCall upon several values from a database
    primarykey
    data
    text
    <p>I am trying to retrieve like several different values from a table. I got it working, but it is actually only sending me the last value it calls. I have done several different things trying to call all my values, but it is not working. Here is what I have.</p> <pre><code>$infoChanger = $_GET['changer']; $username = $_GET['user']; $sql="SELECT * FROM Login_Info WHERE user='".$username."'"; $r = mysql_query($sql,$con); $row = mysql_fetch_array($r); if ($row[7] != "") { if ( $infoChanger == 1 ) { echo $row['user']; } else if ( $infoChanger == 2 ) { echo $row['health']; } else if ( $infoChanger == 3 ) { echo $row['maxHealth']; } else if ( $infoChanger == 4 ) { echo $row['gold']; } else if ( $infoChanger == 5 ) { echo $row['xp']; } else if ( $infoChanger == 6 ) { echo $row['xpRequire']; } else if ( $infoChanger == 7 ) { echo $row['eg']; } } else { echo "false"; } </code></pre> <p>This was my last attempt to try to do it. But it only return the value of the last one "eg". I have it set on an a loop to call here is what I use to call it.</p> <pre><code>function recallCharInfo(user) { xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } while (infoChanger &lt; 7) { infoChanger += 1; xmlHttp=GetXmlHttpObject(); var url="charinfo.php?user=" + user + "&amp;changer=" + infoChanger; xmlHttp.onreadystatechange=stateChanged xmlHttp.open("GET",url,true) xmlHttp.send(null); } } </code></pre> <p>I am trying to get them all to display, but just isn't working the way and I don't want to make a function for each one value I am trying to call. Does anyone know what is wrong with this or have I just done this wrong?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload