MySQL/PHP Update statement outputting white page with no errors -
im trying update records in table followin, problem browser outputs empty white page no source, can see i'm doing wrong?
<?php require 'dbconfig.php'; //always place code @ top of page session_start(); if (!isset($_session['id'])) { // redirection login page twitter or facebook header("location: index.php"); } function safe($value){ return mysql_real_escape_string($value); } // variables $_session['username']; $_session['oauth_provider']; $uid = $_session['id']; $email = safe($_post["email"]); $credits = safe($_post["credits"]); $query = mysql_query("update users set email= '$email' id='$uid'") or die(mysql_error()); ?>
you have assigned variable query, not running it.
$query = mysql_query("update users set email= '$email' id='$uid'") or die(mysql_error());
so, above redundant code. run it, should call $query
, this
if($query){ echo 'updated performed'; }else{ echo 'update failed'; }
note i'm not encouraging use mysql_
functions weak, vulnerable , deprecated. intead should learn more pdo
Comments
Post a Comment