Jump to content

[SOLVED] How to create a function to protect database.


redarrow

Recommended Posts

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");

?>

 

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;

?>

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.