I have this page:
Code: <?php
session_start();
//connect to server and select database
$conn = mysql_connect("localhost", "root", "")
or die(mysql_error());
$db = mysql_select_db("smrpg", $conn) or die(mysql_error());
//show scouts characters
$get_scouts = "select * from scouts where username = '".$_SESSION['userName']."'";
$get_scouts_res = mysql_query($get_scouts, $conn) or die(mysql_error());
while ($list_scouts = mysql_fetch_array($get_scouts_res)) {
$identity = ucwords($list_scouts['identity']);
$topic_id = $list_scouts['id'];
echo "<ul class="character_list"><li><a href="fight.php?identity=$identity">$identity</li></ul> ";
}
?>
And it goes to this page:
Code: <?php
session_start();
//connect to server and select database
$conn = mysql_connect("localhost", "root", "")
or die(mysql_error());
$db = mysql_select_db("smrpg", $conn) or die(mysql_error());
//check for required info from the query string
if (!$_GET['identity']) {
header("Location: train_fight.php");
exit;
}
//get derived values
$derived = "select * from derived_values where identity = $_GET[identity]";
$derived_res = mysql_query($derived, $conn) or die(mysql_error());
$display_block = "<ul>";
while ($derived_info = mysql_fetch_array($derived_res)) {
$derived_id = $derived_info['id'];
$derived_identity = $derived_info['identity'];
$derived_health = $derived_info['health'];
$derived_energy = $derived_info['energy'];
$derived_acv1 = $derived_info['acv1'];
$derived_acv2 = $derived_info['acv2'];
$derived_dcv1 = $derived_info['dcv1'];
$derived_dcv2 = $derived_info['dcv2'];
$derived_total_cp = $derived_info['total_cp'];
$display_block .= "<li>$derived_identity</li>";
}
$display_block .= "</ul>";
?>
But I am getting this error:
You have an error in your SQL syntax; check the manual that correspondsto your MySQL server version for the right syntax to use atline 1
What am I doing wrong here? If I change my where statement or take it out, it is displaying the information, but I can't figure out what's wrong with my where statement or where I'm getting my "identity" from. Something's wrong but I can't find it. Can anyone help?
Simple code help with redirects
I am trying to figure out a redirect script that detects if the browser is IE 7 and if it does, redirect the user to another page. Is this even possible?
Combining Two Queries
I have two scripts that each work fine by themselves. One is a search script with a variable that depends on what people search for. That will display results, but they are in a single column. I want
Dealing with code in db query
I am dealing with C code and I need to make sure it is encoded some how to ensure its integrity and then decoded. For security and later readability.
Procedural to OOP
ohn Kleijn said that to avoid writing "crappy code", we should learn OOP and common OO principles. I've started reading OOP tutorials including the design patterns. And John is right, this
what are '%S%', '%E%'
for example when i see Code: [Select]printf("Hello %s\r\n", $name);what does %s means ?
Big Problem!! Please help
Hi Guys,Im making a website for a friend have encountered a really annoying problem. When every i run the script below i get this error: "Parse error: syntax error, unexpected '}' in
UDS 4.0 Datatype issue
UDS 4.0.322 -- connecting to NI Labview 9.0
Preserving user-entered linebreaks
Hi, I'm building a web 2.0 thingy from scratch and I wanna display text which users input. It's all good so far, except that all the linebreaks are destroyed, so no matter how carefully they insert
Error in query: Resource id #4??
hey guys, having a minor (i think) problem here that i havent been able to figure out. long story short, im building a hockey stat tracking site for a local hockey league around here.my problem is, i
Session
I am having a little trouble with a session. Not sure if it is my browser or what. I know I do not have any trouble logging into forums such at these, so not sure why this is not working.first the