sendind a querystring to a database

Alles, was MariaDB und MySQL betrifft, kann hier besprochen werden.

sendind a querystring to a database

Postby ALADDIN_1978 » 17. October 2018 00:20

I got this querystring from another page.

echo $_GET['ID'];

I want to pass the ID into the database table.


$query = "SELECT * FROM login where ID=$_GET['ID']"; or is it $query = "SELECT * FROM login where ID='$_GET['ID']'"


I am trying to query the database table for the ID.

Any ideas ?
ALADDIN_1978
 
Posts: 7
Joined: 26. September 2018 18:24
XAMPP version: 3.2.2
Operating System: Windows 10

Re: sendind a querystring to a database

Postby Altrea » 17. October 2018 07:36

Simply try it out yourself!?
Cost you only 5 Minutes of your time.
But the gain on experience is priceless.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 9358
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: sendind a querystring to a database

Postby ALADDIN_1978 » 18. October 2018 23:56

echo $_GET['ID'];

I want to pass the ID into the database table.


$query = "SELECT * FROM login where ID=$_GET['ID']"; or is it $query = "SELECT * FROM login where ID='$_GET['ID']'"


I am trying to query the database table for the ID.

I did'

echo $_GET['ID'];

I want to pass the ID into the database table.


$query = "SELECT * FROM login where ID=$_GET['ID']"; or is it $query = "SELECT * FROM login where ID='''$ID''"


I am trying to query the database table for the ID.

I tried both ways it works with normal mysql but not mariasql
ALADDIN_1978
 
Posts: 7
Joined: 26. September 2018 18:24
XAMPP version: 3.2.2
Operating System: Windows 10

Re: sendind a querystring to a database

Postby ALADDIN_1978 » 11. November 2018 14:20

I got the code working, using a different php style !!
ALADDIN_1978
 
Posts: 7
Joined: 26. September 2018 18:24
XAMPP version: 3.2.2
Operating System: Windows 10

Re: sendind a querystring to a database

Postby Altrea » 11. November 2018 14:21

What do you mean by different style?
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 9358
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: sendind a querystring to a database

Postby ALADDIN_1978 » 18. November 2018 21:52

That could be the reason.

*********************************
If you're writing new code, please don't use the mysql_* functions. They are old and broken, were deprecated in PHP 5.5 (which is so old it no longer even receives security updates), and completely removed in PHP 7. Use PDO or mysqli_* with prepared statements and parameter binding instead. See stackoverflow.com/q/12859942/354577 for details


**********************************
ALADDIN_1978
 
Posts: 7
Joined: 26. September 2018 18:24
XAMPP version: 3.2.2
Operating System: Windows 10


Return to MariaDB - MySQL

Who is online

Users browsing this forum: No registered users and 4 guests