Jump to content

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

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.