Jump to content

[SOLVED] UPDATE mysql


LostKID

Recommended Posts

im having problem trying to update a bunch of information. how can i do this all in one go?

 

im currently using:

 

<?php 
include("connect.php");

// CALL IN VARIABLES
$fname = strip_tags(mysql_real_escape_string($_POST['fname']));
$lname = strip_tags(mysql_real_escape_string($_POST['lname']));
$gamert = strip_tags(mysql_real_escape_string($_POST['gamert']));
$youtube = strip_tags(mysql_real_escape_string($_POST['youtube']));
$web = strip_tags(mysql_real_escape_string($_POST['web']));
$bio = strip_tags(mysql_real_escape_string($_POST['bio']));


// THE QUERY
$query5 = "UPDATE user SET fname = '$fname', lname = '$lname', gamert = '$gamert', youtube = '$youtube', web = '$web', bio = '$bio' WHERE email='{$_SESSION['email']}'";
$result5 = mysql_query($query5) or die ("error editing information");
if($result5){
echo "information Successfully changed";
print "<meta http-equiv=\"refresh\" content=\"0;URL=page.php?id=$id\">";
}

?>

 

but it doesnt seem to be working..

Link to comment
https://forums.phpfreaks.com/topic/174374-solved-update-mysql/
Share on other sites

sorry im such a twit im so lost in my ways i forgot to explain the situation.

 

okay so basically im building an edit information page. the page is submitted and then it goes to edit_process.php. then it uses the code before. i dont get any errors just a success echo. i check the fields and it doesnt seem to have updated the fields in mysql.

 

is there a certain way to bulk UPDATE in a query or is the way i done it correct?

Link to comment
https://forums.phpfreaks.com/topic/174374-solved-update-mysql/#findComment-919189
Share on other sites

I don't know what you mean by bulk !

if you mean many different queries at once then MySQLI could do it,

 

Looking back on your code the one thing i would suggest is you echo the query on the success, as i believe your

WHERE email='{$_SESSION['email']}'

would become

WHERE email=''

as i seen no session_start(); in your script

Link to comment
https://forums.phpfreaks.com/topic/174374-solved-update-mysql/#findComment-919194
Share on other sites

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.