Why doesn't this query work for the specified date?


User 7475343

I have connected my database using php. When I press the delete button, a php file is connected to another php file with the following code:

<?php include("dbconfig.php");
 $memberID = $_GET['memberID'];
 $ISBN = $_GET['ISBN'];
 $copyNr = $_GET['copyNr'];
 $date_of_borrowing = $_GET['date_of_borrowing'];

//getting id of the data from url
$sql="DELETE FROM borrows WHERE ISBN=$ISBN AND memberID=$memberID AND copyNr=$copyNr AND date_of_borrowing=$date_of_borrowing";
$result = mysqli_query($conn,$sql);


//redirecting to the display page (borrows_table.php in our case)
//header("Location:borrows_table.php");

?>

When I run this code without "AND date_of_borrowing=$date_of_borrowing" it removes tuples correctly, but when shown, nothing happens. I checked that the variables memberID, ISBN, copyNr and date_of_borrowing are actually correct given in this file. So what could be the problem?

Raja Vikraman

Do an echo $sql before the query. Mysql only accepts the following format YYYY-MM-DD HH:II:SS For Ex: 2019-05-20 12:39:30 and put your date in quotes


$sql="DELETE FROM borrows WHERE ISBN=$ISBN AND memberID=$memberID AND copyNr=$copyNr AND date_of_borrowing='$date_of_borrowing'";

echo $sql;

$result = mysqli_query($conn,$sql);

Related


Why doesn't this query work for the specified date?

User 7475343 I have connected my database using php. When I press the delete button, a php file is connected to another php file with the following code: <?php include("dbconfig.php"); $memberID = $_GET['memberID']; $ISBN = $_GET['ISBN']; $copyNr = $_GET['c

Why doesn't this DATE operator work for my query?

Tim: Can anyone explain to me why the query runs when trying to select data with dates greater than a certain date, but still see dates after 2020-09-01? Due_date is a Date and is stored in the MySQL database as YYYY-MM-DD. Select * from re

Why doesn't this DATE operator work for my query?

Tim: Can anyone explain to me why the query runs when trying to select data with dates greater than a certain date, but still see dates after 2020-09-01? Due_date is a Date and is stored in the MySQL database as YYYY-MM-DD. Select * from re

Why doesn't this DATE operator work for my query?

Tim: Can anyone explain to me why the query runs when trying to select data with dates greater than a certain date, but still see dates after 2020-09-01? Due_date is a Date and is stored in the MySQL database as YYYY-MM-DD. Select * from re

why this query doesn't work

Nicoletta Sotiri I'm new to SQL so I don't understand why this query doesn't work. Thank you in advance CREATE VIEW temp AS SELECT return_date_time, renting_date_time FROM renting; CREATE TRIGGER charge_calc AFTER UPDATE ON renting.return_date_time FOR EACH R

Why doesn't this query work?

username Why does the following query not work in SQL Server 2008? SELECT CONVERT(INT, TEMP.observ_value) AS value FROM (SELECT observ_value FROM LAB_RESULTS WHERE observ_value NOT LIKE '%[^0-9]%') TEMP WHERE observ_value >= 190 Her

Why doesn't this query work?

username Why does the following query not work in SQL Server 2008? SELECT CONVERT(INT, TEMP.observ_value) AS value FROM (SELECT observ_value FROM LAB_RESULTS WHERE observ_value NOT LIKE '%[^0-9]%') TEMP WHERE observ_value >= 190 Her

Date field query in firestore doesn't work

Dave Hannigan: I'm new to programming and just a hobby, usually if I have a question, I can find the answer somewhere on the internet, but it took me the better part of 2 days and still can't find the answer. I am writing an android application using kotlin an

Elasticsearch query with date doesn't work

Kumar When I use elasticsearch query to find today's birthday it doesn't show any results http://localhost:7272/test/contacts/_search?q=(bdaydate:1991-12-29) But the same works fine when using the following http://localhost:7272/test/contacts/_search?q=(bdayd

PowerBI query doesn't work with date filter

Leniel Macafferi I have this DAX: Earned Daily = VAR d = SELECTEDVALUE ( 'P6 Update'[Date] ) RETURN IF ( 'Data for Pivot'[Date] <= d && 'Data for Pivot'[Act Rem] = "Actual Units" && 'Data for Pivot'[Type] = "Current", 'Data for Pivot'[V

Stored procedure date query doesn't work

user 2796000 I am stuck comparing two dates in plsql programming. I have 2 stored procedures. The first stored procedure returns me the date column as a OUTparameter . I put the first output parameter as the input parameter of the second stored procedure. But

Date field query in firestore doesn't work

Dave Hannigan: I'm new to programming and just a hobby, usually if I have a question I can find the answer somewhere on the internet, but it took me the better part of 2 days and still can't find the answer. I am writing an android application using kotlin and

PowerBI query doesn't work with date filter

Leniel Macafferi I have this DAX: Earned Daily = VAR d = SELECTEDVALUE ( 'P6 Update'[Date] ) RETURN IF ( 'Data for Pivot'[Date] <= d && 'Data for Pivot'[Act Rem] = "Actual Units" && 'Data for Pivot'[Type] = "Current", 'Data for Pivot'[V

Stored procedure date query doesn't work

user 2796000 I am stuck comparing two dates in plsql programming. I have 2 stored procedures. The first stored procedure returns me the date column as a OUTparameter . I put the first output parameter as the input parameter of the second stored procedure. But

Why scalar date GraphQL doesn't work

Ramzan Chasygov graphqlI need to provide date ideas in a project I'm using graphql, when I use type date Stringcorrectly in the parser it shows the date, but when I use it scalar Datein the parser I get an falseinteger date. Couldn't find anything in the docum

Why doesn't my date work in TypeScript?

Lord Wardmoot I am trying to initialize a Date object in the following way: let date = new Date(2020, 12, 5, 0, 0, 0, 0); then when i do date.getMonth() I get it 0. Can someone help me? and Oswald Months are zero-indexed, so the month to use for initializati

Why scalar date GraphQL doesn't work

Ramzan Chasygov graphqlI need to provide date ideas in a project I'm using graphql, when I use type date Stringcorrectly in the parser it shows the date, but when I use it scalar Datein the parser I get an falseinteger date. Couldn't find anything in the docum

Why scalar date GraphQL doesn't work

Ramzan Chasygov graphqlI need to provide date ideas in a project I'm using graphql, when I use type date Stringcorrectly in the parser it shows the date, but when I use it scalar Datein the parser I get an falseinteger date. Couldn't find anything in the docum

Why scalar date GraphQL doesn't work

Ramzan Chasygov graphqlI need to provide date ideas in a project I'm using graphql, when I use type date Stringcorrectly in the parser it shows the date, but when I use it scalar Datein the parser I get an falseinteger date. Couldn't find anything in the docum

Why scalar date GraphQL doesn't work

Ramzan Chasygov graphqlI need to provide date ideas in a project I'm using graphql, when I use type date Stringcorrectly in the parser it shows the date, but when I use it scalar Datein the parser I get an falseinteger date. Couldn't find anything in the docum

Why scalar date GraphQL doesn't work

Ramzan Chasygov graphqlI need to provide date ideas in a project I'm using graphql, when I use type date Stringcorrectly in the parser it shows the date, but when I use it scalar Datein the parser I get an falseinteger date. Couldn't find anything in the docum

Why doesn't my date work in TypeScript?

Lord Wardmoot I am trying to initialize a Date object in the following way: let date = new Date(2020, 12, 5, 0, 0, 0, 0); then when i do date.getMonth() I get it 0. Can someone help me? and Oswald Months are zero-indexed, so the month to use for initializati

Why doesn't my date work in TypeScript?

Lord Wardmoot I am trying to initialize a Date object in the following way: let date = new Date(2020, 12, 5, 0, 0, 0, 0); then when i do date.getMonth() I get it 0. Can someone help me? and Oswald Months are zero-indexed, so the month to use for initializati

why date conversion doesn't work in linq

Sunan I am new to mvc and I have a problem with the following code, it throws an exception: LINQ to Entities does not recognize method 'System.String ToString(System.DateTime)'method and the method cannot be converted to a store expression. public ActionR

Why doesn't this date format work?

Earl Grey Tea I'm confused. I read the international specs about the format... but it seems to return nil in playgrounds and code. let dateString = "022018" let formatter = NSDateFormatter() formatter.setLocalizedDateFormatFromTemplate("MMyyyy") let date = f

Why scalar date GraphQL doesn't work

Ramzan Chasygov graphqlI need to provide date ideas in a project I'm using graphql, when I use type date Stringcorrectly in the parser it shows the date, but when I use it scalar Datein the parser I get an falseinteger date. Couldn't find anything in the docum

Why scalar date GraphQL doesn't work

Ramzan Chasygov graphqlI need to provide date ideas in a project I'm using graphql, when I use type date Stringcorrectly in the parser it shows the date, but when I use it scalar Datein the parser I get an falseinteger date. Couldn't find anything in the docum

Why scalar date GraphQL doesn't work

Ramzan Chasygov graphqlI need to provide date ideas in a project I'm using graphql, when I use type date Stringcorrectly in the parser it shows the date, but when I use it scalar Datein the parser I get an falseinteger date. Couldn't find anything in the docum

Why scalar date GraphQL doesn't work

Ramzan Chasygov graphqlI need to provide date ideas in a project I'm using graphql, when I use type date Stringcorrectly in the parser it shows the date, but when I use it scalar Datein the parser I get an falseinteger date. Couldn't find anything in the docum