Jump to content

inserting information into a database


alarik149

Recommended Posts

I really need your help.I am trying for a few days to make a script work,I posted it here but still i did not recieved a specific answer to where my problem is.I wanna drop that whole script and instead I want to ask you to give me the script I need,it is just a few lines I think it`s the most basic think of any mySQL programer.
SO : I have a database named 'championships' with password '123' the host 'localhost' and a table named 'signups' with 3 fields 'id' 'username' and 'status' .
id is the keyframe with auto_increment.
I want to add into this database the row with this values :
3, for field 'id' ;
adrian, for field 'username;
pending,for field 'status';

It would mean EXTREMLY much to me if some1 told me exacly what to do.I am reading google and .pds for a few days now but I don`t manage to do this properly.The database works perfectly if I add the information from MyAdmin.
Please help me
Link to comment
https://forums.phpfreaks.com/topic/4328-inserting-information-into-a-database/
Share on other sites

[code]<?php
$db = mysql_connect('yourserver', 'yourusername', 'yourpassword');
mysql_select_db('championships', $db);
$result = mysql_query("INSERT INTO signups (id, username, status) VALUES (3,'adrian','pending')");
if ($result) echo "woohoo it worked!";
else echo "sorry buster";
?>[/code]

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.