How would I make a code that dynamicly gets MySQL and makes it like ?UserID=54556 :-/?

[
$UserID = 54556;
$query = "select * from table where UserId = $UserID";
]

commented: Did you see the like? =P +0

I saw

How would I make a code that dynamicly gets MySQL and makes it like ?UserID=54556 ?

You want to explain a bit more?

Maybe you want

select * from table where UserID like "%something%"
Member Avatar for diafol

Make your url, e.g.: www.example.com/users.php?id=372687

Pick up the querystring 'id':

$id = mysql_real_escape_string($_GET['id']);

$rs = mysql_query("SELECT ... FROM ... WHERE id = '$id'");

...

Make your url, e.g.: www.example.com/users.php?id=372687

Pick up the querystring 'id':

$id = mysql_real_escape_string($_GET['id']);

$rs = mysql_query("SELECT ... FROM ... WHERE id = '$id'");

...

Of course with this, you'd want to take two things in to account. First, the variable in double-quotes for the mysql_query() are a bit slower so you may want to do this instead:

$rs = mysql_query("SELECT ... FROM ... WHERE id = '" . $id . "'");

Also, since you are accepted a variable from the user, and throwing it into a SQL query, you'll want to test it for MySQL injection.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.