Jump to content

Recommended Posts

<?
include("../include/session.php")

    $q = "SELECT username,points FROM users WHERE username='" . $username . "'";
    $result = $database->query($q);
   if(!$result || ($num_rows < 0)){
      echo "Error displaying info";
      return;
   }
   if($num_rows == 0){
      echo "Database table empty";
      return;
   }

    for($i=0; $i<$num_rows; $i++){
       $existingpoints = mysql_result($result,$i,"points");
       $points = $existingpoints + $addpoints;

   echo = "$points";

?>

 

Is there anything wrong with this code? Every time I try to execute it, I get this error message:

 

Parse error: syntax error, unexpected T_VARIABLE in /home/levente/public_html/site/test/admin/processpoints.php on line 4

 

Thanks in advance!

Link to comment
https://forums.phpfreaks.com/topic/123791-problem-with-sql-no-2/
Share on other sites

Do you think there is something wrong with the server?

 

When I try to post this form:

 

<html>

<head>
<title>Add points</title>
</head>

<body>

<form action="processpoints.php" method=post>

<b>Username: </b><input type="text" name="korisnickoime" size=30>

<br /><br />

<b>How many points would you like to add: </b><input type="text" name="addpoints" size=5>

<br /><br />

<input type=submit>

</form>

</body>

</html>

 

To this PHP:

 

<p><?=$korisnickoime ?></p>
<br /><br />
<p><?=$points ?></p>

 

And it does not display anything.

Do you think there is something wrong with the server?

 

Nope, your code is just wrong.  First, in your HTML, put quotes around the word post:

<form action="processpoints.php" method="post">

 

Then in your PHP, try:

<p><?php echo $_POST['korisnickoime']; ?></p>
<br /><br />
<p><?php echo $_POST['points']; ?></p>

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.