Jump to content

[SOLVED] activation


onthespot

Recommended Posts

This is my code

 

<?php
$query="UPDATE ".TBL_USERS." SET userlevel = 1 WHERE username = '$user'";
$stats1 = "INSERT INTO fifa09_stats VALUES ('$user', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0')";
$stats2 = "INSERT INTO fifa10_stats VALUES ('$user', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0')";
$stats3 = "INSERT INTO pes09_stats VALUES ('$user', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0')";
$stats4 = "INSERT INTO pes10_stats VALUES ('$user', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0')";
if (md5($user) == $act){
mysql_query($query);
mysql_query($stats1);
mysql_query($stats2);
mysql_query($stats3);
mysql_query($stats4);
echo "Congratulations, activation complete. You may now log in and enjoy all of our features.";
}
else {
echo "We are sorry, but this activation request doesn't exist";
}

?>

 

The $query variable works perfect, but the other 4 don't work? Any ideas?

Link to comment
Share on other sites

<?php
$query="UPDATE ".TBL_USERS." SET userlevel = 1 WHERE username = '$user'";
$stats1 = "INSERT INTO fifa09_stats VALUES ('$user', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0')";
$stats2 = "INSERT INTO fifa10_stats VALUES ('$user', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0')";
$stats3 = "INSERT INTO pes09_stats VALUES ('$user', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0')";
$stats4 = "INSERT INTO pes10_stats VALUES ('$user', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0')";
if (md5($user) == $act){
mysql_query($query) or die(mysql_error());
mysql_query($stats1) or die(mysql_error());
mysql_query($stats2) or die(mysql_error());
mysql_query($stats3) or die(mysql_error());
mysql_query($stats4) or die(mysql_error());
echo "Congratulations, activation complete. You may now log in and enjoy all of our features.";
}
else {
echo "We are sorry, but this activation request doesn't exist";
}

?>

 

I changed the code to that, and ran it, didn't get an error, but still didn't populate the tables?

Link to comment
Share on other sites

That style of insert is... basically bad. What if you want to add a column to your table later on? I had to work on another programmer's project before, and he had used the same kind of insert style that you're using. It was a nightmare.

 

INSERT INTO fifa09_stats VALUES ('$user', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0')

 

INSERT INTO fifa09_stats (List of columns you're inserting into) VALUES(Corresponding values).

 

Could help in a situation like this. Will also allow you to set the other columns as default 0 and only have to insert $user.

Link to comment
Share on other sites

ok sorry the first query WORKS though.

I tried the following

 

$stats1 = "INSERT INTO fifa09_stats (user, home_games_played, home_wins, home_draws, home_losses, home_goals_for, 
home_goals_against, home_points, away_games_played, away_wins, away_draws, away_losses, away_goals_for, away_goals_against, away_points) 
VALUES ('$user', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0')";

 

still didnt have any joy?

Link to comment
Share on other sites

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.