...

View Full Version : help with error



Pandabeer
03-05-2009, 08:17 PM
14 mysql_select_db("deb16598_samp") or die(mysql_error());
15 $query = "SELECT * FROM users WHERE name=".$sendedname .""
16 mysql_query("".$query . "") or die(mysql_error());

i get errors here:


Parse error: syntax error, unexpected T_STRING in public_html/stats.php on line 16

Iszak
03-05-2009, 08:26 PM
Line 15, forgot the semi-colan.

Pandabeer
03-05-2009, 08:36 PM
Line 15, forgot the semi-colan.

ty man

Iszak
03-05-2009, 08:39 PM
What? It should be..


mysql_select_db("deb16598_samp") or die(mysql_error());
$query = "SELECT * FROM users WHERE name=".$sendedname."";
mysql_query("".$query . "") or die(mysql_error());

You could probably remove the ."" at the end too because it's useless.

Pandabeer
03-05-2009, 08:39 PM
double post >.>


mysql_select_db("deb16598_samp") or die(mysql_error());
$query = "SELECT * FROM users WHERE name=".$sendedname ."";
mysql_query(".$query . ") or die(mysql_error());

now i got this:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.SELECT * FROM users WHERE name= .' at line 1

Iszak
03-05-2009, 08:42 PM
It's basically you're query, check the value of $sendedname, and maybe clean your code up so it's more readible like..



mysql_select_db("deb16598_samp") or die(mysql_error());

$sql = "SELECT * FROM `users`
WHERE `name` = '{$sendedname}'";

$query = mysql_query($sql)
or die(mysql_error());

Pandabeer
03-05-2009, 08:50 PM
It's basically you're query, check the value of $sendedname, and maybe clean your code up so it's more readible like..



mysql_select_db("deb16598_samp") or die(mysql_error());

$sql = "SELECT * FROM `users`
WHERE `name` = '{$sendedname}'";

$query = mysql_query($sql)
or die(mysql_error());


this worked now, when i do this:


<p><?php
$name = $_GET['name'];?>
Please
fill in your name so we
can check your account<br>
CASE
SENSITIVE!!
</p>
<div>
<form action="stats.php" method="post">Username
: <input name="sendedname" type="text"><br>
<input value="Send" type="submit">&nbsp;&nbsp;<input value="Reset"
type="reset">
</form>
</div>

and than @ my stats


<?php // Connects to your Database
$sendedname = $_REQUEST["name"];
mysql_connect("my host.", "my user.", "my pass.") or die(mysql_error());
mysql_select_db("deb16598_samp") or die(mysql_error());

$sql = "SELECT * FROM `users`
WHERE `name` = '{$sendedname}'";

$query = mysql_query($sql)
or die(mysql_error());
Print "<table border cellpadding=2>";
while($info = mysql_fetch_array( $query ))
{
Print "<th>Name:</th> <td>".$info['name'] . "</td> </tr>";
Print "<th>Level:</th> <td>".$info['level'] . " </td></tr>";
Print "<th>Exp:</th> <td>".$info['exp'] . "</td> </tr>";
Print "<th>Drugs:</th> <td>".$info['drugs'] . " </td></tr>";
Print "<th>Cash:</th> <td>".$info['money'] . "</td> </tr>";
Print "<th>Bank money:</th> <td>".$info['account'] . " </td></tr>";
Print "<th>Job:</th> <td>".$info['job'] . "</td> </tr></tr>";
}
Print "</table><br />";
?>

it wont' work you know something to do about it?

Pandabeer
03-05-2009, 09:10 PM
this worked now, when i do this:


<p><?php
$name = $_GET['name'];?>
Please
fill in your name so we
can check your account<br>
CASE
SENSITIVE!!
</p>
<div>
<form action="stats.php" method="post">Username
: <input name="sendedname" type="text"><br>
<input value="Send" type="submit">&nbsp;&nbsp;<input value="Reset"
type="reset">
</form>
</div>

and than @ my stats


<?php // Connects to your Database
$sendedname = $_REQUEST["name"];
mysql_connect("my host.", "my user.", "my pass.") or die(mysql_error());
mysql_select_db("deb16598_samp") or die(mysql_error());

$sql = "SELECT * FROM `users`
WHERE `name` = '{$sendedname}'";

$query = mysql_query($sql)
or die(mysql_error());
Print "<table border cellpadding=2>";
while($info = mysql_fetch_array( $query ))
{
Print "<th>Name:</th> <td>".$info['name'] . "</td> </tr>";
Print "<th>Level:</th> <td>".$info['level'] . " </td></tr>";
Print "<th>Exp:</th> <td>".$info['exp'] . "</td> </tr>";
Print "<th>Drugs:</th> <td>".$info['drugs'] . " </td></tr>";
Print "<th>Cash:</th> <td>".$info['money'] . "</td> </tr>";
Print "<th>Bank money:</th> <td>".$info['account'] . " </td></tr>";
Print "<th>Job:</th> <td>".$info['job'] . "</td> </tr></tr>";
}
Print "</table><br />";
?>

it wont' work you know something to do about it?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum