Jump to content

coldn1ght

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

coldn1ght's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. lol my post morphed into starwars roflmao.
  2. thanks for the info and the personal experience, well can I have your messengers incase I have questions? or clarifications. if it is ok with you three though... Some of the people I know aren't so good in terms of sharing their ideas and talents. They don't want competition.
  3. hello, I have the basic/dummies background of php mysql. This post is just to find me a master, in php programming. like a obiwan-lukeskywalker thing. someone that would mold and help me to become a php webmaster, it is my dream to become one. by the way if this post is a violation to the rule, please feel free to delete it, but think first you'll be ruining my dream :'(. j/k seriously if this violates in anyway please do delete it. if any kindhearted php&mysql master out there willing to take me as your student/apprentice. here is my contact list: miomerchie@gmail.com korudekorude@yahoo.com --- yahoo messenger or Instant message here in forums. thank you.
  4. tblUser id INT AUTO_INCREMENT PRIMARY KEY<<---- how to properly set a primary key in phpmyadmin? username VARCHAR(60) tblProfile id INT AUTO_INCREMENT PRIMARY KEY firstName VARCHAR(60) surname VARCHAR(60) userID INT FOREIGN KEY(tblUser.id) <<---- how do I do this using phpmyadmin and establish a relation to tbluser? 1. Im quite lost the values of "id" in both tables are the same as well as the value in "userID" right? 2. Why do I have to make a primary key "ID" in tblProfile when I already got UserID as a foreign key? wouldn't be UserId enough to establish a relation? 3. if id=1810 when it auto increments does the next value for id=1811 or some random number generated by mysql? sorry for being so noob it's kinda confused me.
  5. oh yeah, I'm just giving out an example so I will know how to establish a relation in both table. since I'm making a registration form which inserts the value into the database and then outputs a members page which will also require to select data from database and output it. which brings me to another question how can I set a foreign key using phpmyadmin? do you guys have a sample code for a process.php(registration) and then (members.php)<< how to extract the data from different tables which are linked together with the primary and foreign keys table. and if possible can you show me the database structure so I can understand more how the things work?
  6. thanks i think i get the point now . more help is still welcome.
  7. hmm, so i don't have to issue insert into u_id, right? since the mysql makes a new u_id record everytime I issue an Insert code. correct? if thats the case is my u_id in table 2 is also updated like that of u_id table 1? because i want to access lastname,firstname in table2 and uses the u_id(foreign key) as WHERE. another question: how can I set u_id(table 2) as a foreign key that refers to u_id(table1) as the primary key.? using phpmyadmin.
  8. I'm not sure if it belongs here, but i'll just post it incase you guys have the answer. i have more newbie question regarding the database. Situation: Database--- (table-1) primary key id_num, number, not null,autoincrement, username,not null (table-2) lastname firstname (id_num) foreignkey so everytime I issue an insert command to' username' does the database auto-creates a new id_num(uservalue) which is id_num+1 or I have to issue a php code to create a new one together with the insert code? <<<--- 1st question if the case is I have to issue a php.code createnew id_num(uservalue) for a new user, should I issue a php code to store "id_num(uservalue)" in both table1 and table2? <<<--- 2nd question If possible can you give me a sample_code and a sample_db so I can figure out, how it works.I apologize for such a newbie request-- "So PHP/mySQL noob here".
  9. wow thanks for the input. never thought about bloating. now I know i have to consider storage memory. i have more newbie question regarding the database. Situation: Database--- (table-1) primary key id_num, number, not null,autoincrement, username,not null (table-2) lastname firstname (id_num) foreignkey so everytime I issue an insert command to' username' does the database auto-creates a new id_num(uservalue) which is id_num+1 or I have to issue a php code to create a new one together with the insert code? <<<--- 1st question if the case is I have to issue a php.code createnew id_num(uservalue) for a new user, should I issue a php code to store "id_num(uservalue)" in both table1 and table2? <<<--- 2nd question If possible can you give me a sample_code and a sample_db so I can figure out, how it works.I apologize for such a newbie request-- "So PHP/mySQL noob here".
  10. I have a problem with the database tables, I cant seem to link to table, I tried to click the primary key button in the phpmyadmin. my db set up is like this: ---------------------------------------------- db_name - test table person username - clicked primary key button in phpmyadmin password table specifics username - clicked the unique key button in php my admin firstname lastname -------------------------------------------------- and then i clicked on the relational view and set the "username in specifics" to reference on person->username. im not sure if what i did was right, but the program didn't work, so I assume I'm wrong. so here is my php code for insert.php: <?php $host = "localhost"; $user = "root"; $pass = "arfarf"; $con = mysql_connect($host,$user,$pass); if(!$con) die("Could not connect".mysql_error()); $select_db= mysql_select_db('test',$con); if(!select_db) { die("Failed to connect to database".mysql_error()); mysql_close(); } $username = $_REQUEST['username']; $password = md5($_REQUEST['password']); $firstname = $_REQUEST['firstname']; $lastname = $_REQUEST['lastname']; $query = mysql_query("SELECT * FROM person WHERE username = '$username' "); if (mysql_num_rows($query)!=1) { $sql= "INSERT INTO person(username,password) VALUES ('$username','$password') "; if (!mysql_query($sql,$con)) die ("failed to add record: ".mysql_error()); else $sql= "INSERT INTO specifics(firstname,lastname) VALUES ('$firstname','$lastname') "; if (!mysql_query($sql,$con)) die ("failed to add record: ".mysql_error()); else echo include("index.php"); } else { echo "<font face='tahoma' color='red'> Username already exists. </font>"; include("signup.php"); } mysql_close(); ?> --------------------- this is the error I always get when I run the script: Failed to add record: Field 'username' doesn't have a default value note: when i viewed my database after running the script, this is what happened. ------------------------------------------------------------------------- the $username and $password that the user inputs is stored in persons table under username and password field, but when I opened the username field in the specifics table, its empty. my problem is honestly im not sure what? but the way I see it, I think its on how to: link my two tables. how to set my username field as primary key for "person" table and a foreign key for "specifics" table.(using phpmyadmin) how to have the same data between 2 "username" in both field. or please tell me where my problem really lies thank you. please reply here or email me at miomerchie@gmail.com or contact me ymsgr korudekorude@yahoo.com
×
×
  • 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.