redarrow Posted September 21, 2009 Share Posted September 21, 2009 my example does not work lol, how do you create a funtion to protect database information.. and add it to any set varable to work? <?php function valadate($x){ $x=mysql_real_esape_string($_POST['$x']); return($x); } echo valadate($x="john"); ?> Quote Link to comment Share on other sites More sharing options...
ozestretch Posted September 21, 2009 Share Posted September 21, 2009 <?php function valadate($x){ $x=mysql_real_esape_string($_POST['$x']); // should this - $_POST['$x'] actually be $x !? return($x); } echo valadate($x="john"); ?> Quote Link to comment Share on other sites More sharing options...
nankoweap Posted September 21, 2009 Share Posted September 21, 2009 mysql_real_esape_string is spelled incorrectly. it's mysql_real_escape_string. Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 21, 2009 Author Share Posted September 21, 2009 WORKS........ WHY DONT THIS WORK GOING GRAY LOL <?php //CREATE THE FUNCTION. function valadate($x){ $x=mysql_real_escape_string(strip_tags(htmlentities($x, ENT_QUOTES))); return($x); } // ADD A VARIABLE AS WHAT EVER. $redarrow=$_POST['redarrow']; // SET THE VARIABLE AS WHAT EVER $redarrow="redarrow"; //ADD THE FUNTION TO THE VARIABLE. $redarrow=valadate($x=$redarrow); //ECHO THE VARIABLE WITH ADDED FUNCTION. echo $redarrow; ?> Quote Link to comment Share on other sites More sharing options...
nankoweap Posted September 21, 2009 Share Posted September 21, 2009 what errors are you getting? Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 21, 2009 Author Share Posted September 21, 2009 so sorry i had no database add to the page i got mysql error dar i am lol Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.