Jump to content

Add a new row in table?


Breana

Recommended Posts

Ok, i bought this script SE and for the last 2 weeks they have not given me support or help so i am seeking help outside :(

 

I am trying to make my own plugin, and it's 99% done.

I can call the info, save the info by user id. everything but i am stuck at adding the row to the DB!

 

If i ad it maually it works fine but i cant add someone each time they sign up i have a life here lol.

 

I made the id of the row auto_increment. > gametag_id

And added the insert code to the php page. but it just wont add a new row no error nothing.

 

Here is my code from the new plugin for SE

if($task == "create_new_id") {
  
  $database->database_query("INSERT INTO `se_gametags` (`gametag_id`, `gametag_user_id`, `gametag_note`, `gametag_active`) VALUES
( '', '".$user->user_info[user_id]."', 'No Personal Note Set!', 1)");
}

How do i get it to add a new row in the table??

Link to comment
Share on other sites

do you have a connection to the database?

 

echo your statement to see what is going on

 

if (!$con)

{

die ('could not connect: ' . mysql_error());

echo mysql_errno($con) . " : " . mysql_error($con). "\n";

}

 

// in your case change $sql to your sql string name, and $con to your connect name

if (!mysql_query($sql,$con))

  {

  die('Error: ' . mysql_error());

  }

 

 

hope this helps

Link to comment
Share on other sites

Try this and see what it does.

 

if($task == "create_new_id") {

  $database->database_query("INSERT INTO se_gametags (gametag_user_id, gametag_note, gametag_active) VALUES
('{$user->user_info['user_id']}', 'No Personal Note Set!', '1')");
}

 

Assuming $user->user_info['user_id'] is set.

 

Do yo have any errors?

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.