473,394 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to redirect

6
Will you tell what I'm doing wrong. It goes straight to "expiredpage.html" even though the value
of "expiry" is more than 0. I keep studying redirection and variable definition but nothing works. It does
update.
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $link = mysqli_connect("localhost", "root", "", "prerentdb"); 
  3. // Check connection
  4. if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); }
  5.  
  6. $id='id';
  7. $expiry='expiry';
  8.  
  9. $sql = "UPDATE numbers SET expiry=$expiry- 1 where id=$id";
  10. if(mysqli_query($link, $sql)){ echo "expiry was updated successfully."; } 
  11. else { echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); }
  12.  
  13. if ($expiry == 0) { 
  14. header("location:expiredpage.html");
  15. // window.location.href = 'expiredpage.html';
  16. // $(location).attr('href', 'expiredpage.html')
  17.  } 
  18.  
  19. else  { 
  20.  header("location:sysnav.html");
  21. //window.location.href = 'sysnav.html';
  22. //  $(location).attr('href', 'sysnav.html')
  23.  } 
  24. // Close connection
  25. mysqli_close($link);
  26. ?>
Aug 11 '21 #1
1 1994
dev7060
636 Expert 512MB
bytM3
Will you tell what I'm doing wrong. It goes straight to "expiredpage.html" even though the value
of "expiry" is more than 0. I keep studying redirection and variable definition but nothing works. It does
update.
Src https://wiki.php.net/rfc/string_to_n...n#introduction
Comparisons between strings and numbers using == and other non-strict comparison operators currently work by casting the string to a number, and subsequently performing a comparison on integers or floats. This results in many surprising comparison results, the most notable of which is that 0 == "foobar" returns true. This RFC proposes to make non-strict comparisons more useful and less error prone, by using a number comparison only if the string is actually numeric. Otherwise the number is converted into a string, and a string comparison is performed.
Aug 22 '21 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Bob Garbados | last post by:
forgive my ignorance, as I'm new to php coming from a ms background... If I create a page named redirect.php and it's only content is: <?php header("Location: http://www.google.com"); ?>...
3
by: Paul | last post by:
I'm not getting the results I want when I use Response.Redirct in a ASP page. I enter this line of code in a asp page from domain1.com. Response.Redirect...
7
by: Donna Hawkins | last post by:
I want to use javascript to redirect to a URL which has been passed as a variable (in php). I have searched but cannot find any solution. I think this code is a basic redirect: <script...
1
by: Peter Kirk | last post by:
Hi there I have a program written by another company (it's a "web control" which returns a web-page: can I compare this to a servlet in the Java world?), which they think is causing problems on...
2
by: Mark Dengler | last post by:
Is it possible to do a Response.Redirect to multiple URLs? I have tried the following and it simply ignores the first redirect: Response.Redirect("test.aspx", false);...
3
by: Justin | last post by:
Hi, Im confused here over the usage of Response.Redirect and Server.Transfer. I used frameset for my work, what are the proper usages of the two methods that seems working similar.. The...
6
by: Peter Row | last post by:
Hi, I am writing a DLL in VB.NET that implements IHttpHandler.ProcessRequest. This code calls a sub and I need to know if that sub did a response redirect or not. Specifically I need to know...
5
by: venner | last post by:
I'm having an issue with an ASP.NET website after upgrading to ASP.NET 2.0. The website makes use of a central authentication service (CAS) provided at the university I work for. Each page checks...
10
by: Eirik Eldorsen | last post by:
How can I 301 redirect www.example.com/default.aspx to www.example.com without using ISAPI filters?
0
by: sourcy | last post by:
Hi everybody, My name is Andrew and I'm a beginner at PHP. What I'm doing is trying to get a form to check Captcha, send the form contents by email, and then have PHP redirect to the correct page....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.