Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
|
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 16th, 2004, 09:05 PM
Authorized User
 
Join Date: Sep 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem with redirect..

this is may script to delete record from database.

<?php require_once ("common_db.php"); ?>
<?php
        if (!isset($_GET['recordID'])) {
                 echo "<table align=center>
                <tr>
                <td align=center class=\"articolo\"><span class=\"articolo\">Impossibile eliminare l'articolo</span></td>
                </tr>
                </table>";
        }

        $collegamento = db_connect ('$defaultdb');
        if (!$collegamento) die (erroriSql ());


        $eliminazione = mysql_query("DELETE FROM $tabellaArticoli WHERE ID = '" . $_GET['recordID'] . "'");
        if (!isset($aggiornamento)) die (erroriSql ());

?>

The question is: can i redirected to home page when a record is deleted?.


 
Old February 17th, 2004, 02:20 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Hello,

I'm new to PHP, got kind of lost in your script...

However, to redirect you can echo javascript:

echo "<script language=javascript>window.location=\"yourpage.htm \"</script>";

I think you would put it together like this (not too sure):

if($eliminazione)echo "<script language=javascript>window.location=\"yourpage.htm \"</script>";

HTH,

----------
---Snib---
----------
 
Old February 17th, 2004, 02:54 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can also call the header function:
  header("Location: home_page.php");

You can't call this if you've output any text, including whitespace outside of your <?php ?> tags and error messagse.


You can also use the <meta> tag:

  <meta http-equiv="Refresh" content="10; URL=http://www.yoursite.com/">



Take care,

Nik
http://www.bigaction.org/





Similar Threads
Thread Thread Starter Forum Replies Last Post
Repone.Redirect() problem aliirfan84 ASP.NET 2.0 Professional 4 June 13th, 2007 08:29 AM
Response.Redirect Problem msbsam ASP.NET 2.0 Basics 0 February 10th, 2007 03:28 AM
Problem with redirect/replace gorros Javascript 4 March 11th, 2006 07:37 AM
repsponse.redirect problem skipinator ASP.NET 1.0 and 1.1 Basics 3 June 8th, 2003 02:02 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.