Jump to content

[SOLVED] MySql Insert into. ROW?????


DeanWhitehouse

Recommended Posts

how can i insert into a certain row in my database

mysql_query("INSERT INTO `$user` (user_name, user_password, user_email) VALUES ('$user_name','$userPswd','$user_email')")

 

this is the code, i want to use there user_id and/or there user_name to find the row to insert into

Link to comment
https://forums.phpfreaks.com/topic/102435-solved-mysql-insert-into-row/
Share on other sites

so would this be right, to edit details for this getting the row from there id no.

$user_id = $_SESSION['user_id'];
mysql_query("UPDATE SET user_id = '$user_id'  WHERE user_name = $user_name AND user_password = $user_password AND user_email = $user_email")

You got it backwards..

 

$user_id = $_SESSION['user_id'];
mysql_query("UPDATE tablename 
SET user_name = '$user_name', user_password = '$user_password', user_email = '$user_email' 
WHERE user_id = '$user_id'");

 

You will need to enclose strings in single quotes.

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.