Jump to content


MySQL Insert Help


  • Please log in to reply
13 replies to this topic

#1 Guest_PcGamerz13_*

Guest_PcGamerz13_*
  • Guests

Posted 08 September 2006 - 09:04 PM

Why ain't this inserting into the Database no errors are showing up and i have it setup to do that.
@mysql_query("INSERT INTO clan_members SET Gamer_Tag = '$Gamer_Tag', Password = '$Password', Rank = '$Rank2', Rank_Name = '$Rank_Name', Disabled = '$Disabled'");


#2 jefkin

jefkin
  • Members
  • PipPipPip
  • Advanced Member
  • 55 posts

Posted 08 September 2006 - 09:09 PM

Why ain't this inserting into the Database no errors are showing up and i have it setup to do that.

@mysql_query("INSERT INTO clan_members SET Gamer_Tag = '$Gamer_Tag', Password = '$Password', Rank = '$Rank2', Rank_Name = '$Rank_Name', Disabled = '$Disabled'");


'@' means 'be quiet!'

If you use '@' in front of a php function, you're telling php NOT to display errors.

You probably are recieving errors from the function, but you can't tell because you told PHP to be quiet.

Jeff

#3 Guest_PcGamerz13_*

Guest_PcGamerz13_*
  • Guests

Posted 08 September 2006 - 09:13 PM

thanks let me see something

#4 Guest_PcGamerz13_*

Guest_PcGamerz13_*
  • Guests

Posted 08 September 2006 - 09:14 PM

nope still not showing anything

#5 Guest_PcGamerz13_*

Guest_PcGamerz13_*
  • Guests

Posted 08 September 2006 - 09:16 PM

it worked before.....

#6 jefkin

jefkin
  • Members
  • PipPipPip
  • Advanced Member
  • 55 posts

Posted 08 September 2006 - 09:22 PM

Okay, maybe there's something we're assuming.

We could be assuming PHP and MySQL are installed correctly. :)

We could be assuming you have your mysql connection.

We could be assuming that PHP is reporting errors.

We could be assuming that MySQL is reporting errors.

We could be assuming that this code is actually being executed.

Maybe you could check these assumptions.  Beyond that, I can't begin to guess.

Jeff

#7 Guest_PcGamerz13_*

Guest_PcGamerz13_*
  • Guests

Posted 08 September 2006 - 09:23 PM

heres the whole page and yes everyone MYSQL code but that works on that page
<?
include("Config.php");
session_start();
$Member_Gamer_Tag = $_SESSION['Member_Gamer_Tag'];
$sql="SELECT * FROM clan_template";
$mysql_result=mysql_query($sql);
$num_rows=mysql_num_rows($mysql_result);
while ($row=mysql_fetch_array($mysql_result))
{
$Header=$row["Header"];
$Footer=$row["Footer"];
}
echo $Header;
$Blank = "";
$Date = date('l dS \of F Y h:i:s A');
$Disabled = "0";
$Log_Reason = "Recruited $Gamer_Tag .";
$Two = "2";
$Rank2 = "1";
$Rank_Name = "Peon";
$sql2="SELECT * FROM clan_members WHERE Gamer_Tag='$Member_Gamer_Tag'"; 
$mysql_result2=mysql_query($sql2);
$num_rows2=mysql_num_rows($mysql_result2);
while ($row2=mysql_fetch_array($mysql_result2))
{
$Rank=$row2["Rank"];
}
if($Member_Gamer_Tag == $Blank){
?>
<form method="POST" action="Console.php?Login=Yes">
  <center>Gamer Tag: <input type="text" name="Member_Gamer_Tag2" size="20"></center>
  <center>Password:&nbsp;&nbsp; <input type="password" name="Password" size="20"></center>
  <center><input type="submit" value="Submit" name="B1"></center>
</form>
<?
} else {
if($Rank >= $Two){
if($_GET['Recruit_Member'] == Yes){
function generate_code($chars){
for($i=0;$i<=($chars-1);$i++){
$r0 = rand(0,1); $r1 = rand(0,2);
if($r0==0){$r .= chr(rand(ord('A'),ord('Z')));}
elseif($r0==1){ $r .= rand(0,9); }
if($r1==0){ $r = strtolower($r); }
}
return $r;
}
$Password = generate_code(10);
@mysql_query("INSERT INTO clan_members SET Gamer_Tag = '$Gamer_Tag', Password = '$Password', Rank = '$Rank2', Rank_Name = '$Rank_Name', Disabled = '$Disabled'");
@mysql_query("INSERT INTO clan_logs SET Date = '$Date', Gamer_Tag = '$Member_Gamer_Tag', Log = '$Log_Reason'");
echo "<center>His/Her Gamer Tag is $Gamer_Tag and his/her password is $Password .</center>";
}else{
?>
<form method="POST" action="Recruit_Member.php?Recruit_Member=Yes">
  <center>Gamer Tag:&nbsp;<input type="text" name="Gamer_Tag" size="20"></center>
    <center><input type="submit" value="Submit" name="B1"></center>
</form>
<?
}
}else{
echo "<center>Your rank is not high enought to do this.</center>";
}
}
echo $Footer;
?>


#8 Guest_PcGamerz13_*

Guest_PcGamerz13_*
  • Guests

Posted 08 September 2006 - 09:24 PM

BTW its a halo clan script i made to release to people and it worked before but mysql is working.....

#9 jefkin

jefkin
  • Members
  • PipPipPip
  • Advanced Member
  • 55 posts

Posted 08 September 2006 - 09:33 PM

How about modifying it to this:

$result = mysql_query("INSERT INTO clan_members SET Gamer_Tag = '$Gamer_Tag', Password = '$Password', Rank = '$Rank2', Rank_Name = '$Rank_Name', Disabled = '$Disabled'");
if (!$result) {
   die('Invalid query: ' . mysql_error());
}

At least then you're super sure it's not a mysql error. 

#10 Guest_PcGamerz13_*

Guest_PcGamerz13_*
  • Guests

Posted 08 September 2006 - 09:34 PM

k 1 sec

#11 Guest_PcGamerz13_*

Guest_PcGamerz13_*
  • Guests

Posted 08 September 2006 - 09:35 PM

Invalid query: Field 'Aim_ID' doesn't have a default value ?????? why it should not need a Aim_ID

#12 Guest_PcGamerz13_*

Guest_PcGamerz13_*
  • Guests

Posted 08 September 2006 - 09:36 PM

it because of the new version of PHP?

#13 Guest_PcGamerz13_*

Guest_PcGamerz13_*
  • Guests

Posted 08 September 2006 - 09:42 PM

wow a few errors are poping up omg WTF what changed in PHP

#14 Guest_PcGamerz13_*

Guest_PcGamerz13_*
  • Guests

Posted 08 September 2006 - 09:44 PM

fuck this ill try a other server lol





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users