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
https://forums.phpfreaks.com/topic/144221-add-a-new-row-in-table/
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

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.