php not working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BenKen
    New Member
    • Jun 2009
    • 8

    php not working

    Please I'm trying to delete from the database and I get this error

    Warning: session_start() [function.sessio n-start]: Cannot send session cache limiter - headers already sent (output started at E:\webareas\whi le\shop\deleteb ag.php:1) in E:\webareas\whi le\shopping\del etebag.php on line 2

    Warning: Cannot modify header information - headers already sent by (output started at E:\webareas\whi le\shopping\del etebag.php:1) in E:\webareas\whi le\shopping\del etebag.php on line 4

    Warning: mysql_fetch_arr ay(): supplied argument is not a valid MySQL result resource in E:\webareas\whi le\shop\deleteb ag.php on line 44


    Pls help. My code is below.


    Code:
    <?php
    session_start(); // session must put on the top of page.   line 2
    if(!session_is_registered("userName")){ // if session variable "username" is not registered.
    header("location:notauthorised.php"); // Re-direct to login page  line 4
    }
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
    <title>Register</title><link rel="icon" href="http://low.co.uk/while/shop/faviconCAIGCI9K.ICO" type="image/x-icon" > 
    <link rel="shortcut icon" href=" http://low.co.uk/while/shop/ faviconCAIGCI9K.ICO" type="image/x-icon" >
    </head>
    
    <body><table width="100%" border="1">
    <tr>
    	<td colspan ="3" align = "left"><img src="bagpics/shiny-bags-01.JPG" alt="Bag Shop" name="Image3" width="173" height="154" border="0" id="Image3" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    	<img src="bagpics/logo.png" alt="Bag Shop" width="385" height="116" align="bottom" ></td>
    
    </tr>
    <tr>
    	<td width="20%" valign ="top" class="style5"><ul>
    	
        
    	<li>Faq</li>
    	<li>Contact Us</li>
    	<li>Accessibility</li>
    	<li>Terms and Conditions</li>
    	<li><a href=" http://low.co.uk/while/shop/viewbags.php">Bags</li>
    <li><a href=" http://low.co.uk/while/shop/custregister.php">Register</li>
        <li><a href=" http://low.co.uk/while/shop/index.php">Home</li>
    	</ul>
    </td>
    	<td width="60%">
    <?
    $linkme = mysql_connect("localhost","good","lovely");
    if (!$linkme)
    	die ("Could Not Connect to the Database");
    mysql_select_db ("shop", $linkme);
    $bag_id= $_GET['id'];
    $result = mysql_query("SELECT * FROM Bags WHERE bag_id = $bag_id",$linkme);
    $row = mysql_fetch_array($result);   line 44
    ?>
    Are you sure you want to delete
     <? echo  $row['bag_name'] . " " . $row['price'] . " " . $row['size'] . " " . $row['description']  ?>?<br >
    <a href ="deletebag2.php?id=<? echo $bag_id ?>">Yes</a> 
    || <a href = "adminpage.php">No</a> <br >
    <?
    mysql_close($linkme);
    ?> <br ><br ><br ><br ><br ><br ></td>
    	<td width="20%">ADVERTS</td>
    </tr>
    <tr>
    	<td colspan ="3" align = "center">&nbsp;Copyright James </td>
    </tr>
    </table>
    
    </body>
    </html>
    Last edited by Dormilich; Jan 14 '10, 09:14 PM. Reason: Please use [code] tags when posting code
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    error 1: I suspect a BOM (see this article draft)

    error 2: because your query failed. see also mysql_query() (esp. the return value section)

    Comment

    Working...