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
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]
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.