Jump to content

Archived

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

alarik149

inserting information into a database

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

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites

×

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.