PDA

View Full Version : php/mysql help



Jordan,
08-03-2008, 09:25 PM
I keep getting
Parse error: syntax error, unexpected T_VARIABLE in /home/public_html/Ichthus/edituser2.php on line 38

36-42

<?
($_POST['Save'])
$username = htmlspecialchars($_POST[username]);
$nick = htmlspecialchars($_POST[nickname]);
$email = htmlspecialchars($_POST[email]);
$money = htmlspecialchars($_POST[char_money]);
$sql = @mysql_query("USERNAME user SET username = '$username', nickname = '$nick', email = '$email', char_money = '$money' WHERE user = '$user'");

Any ideas

Jy4
08-03-2008, 09:32 PM
Hey,

I'm not too sure mate, but I hope you fix it so Housekeeping can go up :)

Nick.
08-03-2008, 09:44 PM
Try replacing:


($_POST['Save'])

with:


($_POST['Save']);

Not sure if it'll help.

Jordan,
08-03-2008, 09:48 PM
no thanks anyway +rep

Navicat
08-03-2008, 09:51 PM
Well, is that supposed to be an if statement at the top? ..

Jordan,
08-03-2008, 09:53 PM
i dont under stand what u r saying

Navicat
08-03-2008, 10:03 PM
Well ($_POST["blabla"]) is nothing, your not definining anything.. or saying anything.

That probably should be an if statement there. if($_POST["blabla"]) {

Decode
08-03-2008, 10:03 PM
<?php
($_POST['Save']);
$username = htmlspecialchars($_POST[username]);
$nick = htmlspecialchars($_POST[nickname]);
$email = htmlspecialchars($_POST[email]);
$money = htmlspecialchars($_POST[char_money]);
$sql = @mysql_query("USERNAME user SET username = '$username', nickname = '$nick', email = '$email', char_money = '$money' WHERE user = '$user'");
?>

I tried that on php 5.2.5 and there are no errors

Jordan,
08-03-2008, 10:04 PM
Not working

Jme
09-03-2008, 04:28 AM
Try this:


<?php
if ($_POST['Save'])
{
$username = htmlspecialchars($_POST[username]);
$nick = htmlspecialchars($_POST[nickname]);
$email = htmlspecialchars($_POST[email]);
$money = htmlspecialchars($_POST[char_money]);
$sql = @mysql_query("USERNAME user SET username = '$username', nickname = '$nick', email = '$email', char_money = '$money' WHERE user = '$user'");
?>

Protege
09-03-2008, 11:41 AM
I keep getting
Parse error: syntax error, unexpected T_VARIABLE in /home/public_html/Ichthus/edituser2.php on line 38

36-42

<?
($_POST['Save'])
$username = htmlspecialchars($_POST[username]);
$nick = htmlspecialchars($_POST[nickname]);
$email = htmlspecialchars($_POST[email]);
$money = htmlspecialchars($_POST[char_money]);
$sql = @mysql_query("USERNAME user SET username = '$username', nickname = '$nick', email = '$email', char_money = '$money' WHERE user = '$user'");

Any ideas


I didn't check, but I don't understand what your trying to get with but before I even strip anything down I check if value == null. Then I will put the var into a string for easier transfer between different areas of the script (eg: <? $name = $_POST["name"]; ?> )

Usually when im using $_POST in a function I will tag the arguemetn
$username = htmlspecialchars($_POST["username"]); apposed to
$username = htmlspecialchars($_POST[username]);

Id do this personally
$username = $_POST["username"];
$username = function($username);

Also you haven't defined ($_POST['Save']) - Its just placed there out of no where, I'd remove that to start with.

<?
$username = htmlspecialchars($username);
echo($username);
?>

Want to hide these adverts? Register an account for free!