GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 27-Mar-2004, 05:52
Dagma20 Dagma20 is offline
New Member
 
Join Date: Mar 2004
Posts: 3
Dagma20 is on a distinguished road

RE: A simple update and } problem


Hi there could someone help me out with this code pls. I wrote it but it doesn't work . Basically this script is to activate property owners webpages if they have been verified and add there details to a verification table which generates a code to send to the property owner. The problem that i am having, is that the update function isn't working at all. Plus when i remov the last '}' from the first <? ?> of php coding it has a go at me but the thing is, is that it isn't closing any opened '{' ? But more importantly if anyone has any help with this, that would be great. Thnx Oh yeh the error it chucks out is eitherparse error on line 65 or line 74 depending if take out the update function

PHP Code:

<html>
<head>
<title></title>
</head>


<body bgcolor="#FFFFFF">
<? 

$PID = $_POST['PID']; 
$WID = $_POST['WID']; 
$OID = $_POST['OID']; 

if((!$PID) || (!$WID) || (!$OID)) {

echo ("<p> Please fill in of the information </p>");
     
      include 'WPActivator.html'; // Show the form again
     exit();  // exits the script }
  
include 'db.php';

/* The code below checks to see if the following value currently in the database, note also that the error will only occur if neither values are in the database on the same record line and seperate and/or on different records */
 
$sql_PropertyID_check = mysql_query("SELECT Property_ID FROM Owner_WebPages WHERE (Property_ID='$PID')");

$sql_OwnerID_check = mysql_query("SELECT Owner_ID FROM Owner_WebPages WHERE (Owner_ID='$OID')");

$sql_WebPageID_check = mysql_query("SELECT WebPage_ID FROM Owner_WebPages (WHERE WebPage_ID='$WID')");
 

 $PropertyID_check = mysql_num_rows($sql_PropertyID_check);

 $WebPageID_check = mysql_num_rows($sql_WebPageID_check);

 $OwnerID_check = mysql_num_rows($sql_OwnerID_check);

 if(($OwnerID_check > 0) || ($PropertyID_check > 0) || ($WebPageID_check > 0)) {
     
include 'WPActivator.html';
exit ();
}


include 'db.php';

$sql = mysql_query("INSERT INTO WPVCode

                             (Owner_ID, Property_ID, WebPage_ID) 

        VALUES
                              ('$OID', '$PID', '$WID')") or die (mysql_error 
                                ()); 

if(!$sql){ 
    echo 'There has been an error creating your account. Please contact the webmaster.'; 
} else { 
   
echo ("<p> Data Inserted Correctly</p>");
}
}

?>
<?
includ 'db.php';
$sql2= mysql_query ("UPDATE Properties SET (Activated ='1') 
WHERE (Property_ID='$PID' AND Owner_ID='$OID' AND WebPage_ID='$WID')") or die (mysql_error)());

if(!$sql2){ 
    echo 'There has been an error creating your account. Please contact the webmaster.'; 
} else { 
   
echo ("<p> Data Modified Correctly</p>");


} 
?> 

  #2  
Old 27-Mar-2004, 06:21
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
This is why I LIKE syntax highlighting! If you look at the code you pasted above, the error would have been quite obvious even without my reply...

Anyway, try replacing this bit off your code and see if that helps:

PHP Code:

<html>
<head>
<title></title>
</head>


<body bgcolor="#FFFFFF">
<?

$PID = $_POST['PID'];
$WID = $_POST['WID'];
$OID = $_POST['OID'];

if((!$PID) || (!$WID) || (!$OID)) {

echo ("<p> Please fill in of the information </p>");
   
    include 'WPActivator.html'; // Show the form again
   exit();  // exits the script
 } // notice that this is now on it's OWN line!
  
include 'db.php'; 
//... 


  #3  
Old 27-Mar-2004, 09:57
Dagma20 Dagma20 is offline
New Member
 
Join Date: Mar 2004
Posts: 3
Dagma20 is on a distinguished road
nah didn't work it just chucks out the same error. More importantly though, im not sure if my update script works? just wondering if you could see if i wrote it correctly
  #4  
Old 27-Mar-2004, 16:37
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
A few other typos I just noticed...

PHP Code:

<html>
<head>
<title></title>
</head>


<body bgcolor="#FFFFFF">
<?

$PID = $_POST['PID'];
$WID = $_POST['WID'];
$OID = $_POST['OID'];

if( (!$PID) || (!$WID) || (!$OID) )
{
    echo( "<p> Please fill in of the information </p>" );
        include 'WPActivator.html'; // Show the form again
       exit();  // exits the script
}
  
include 'db.php';  ### You've included it once here

/* The code below checks to see if the following value currently in the database, note also that the error will only occur if neither values are in the database on the same record line and seperate and/or on different records */

$sql_PropertyID_check = mysql_query( "SELECT Property_ID FROM Owner_WebPages WHERE (Property_ID='$PID')" );
$sql_OwnerID_check    = mysql_query( "SELECT Owner_ID FROM Owner_WebPages WHERE (Owner_ID='$OID')" );
$sql_WebPageID_check  = mysql_query( "SELECT WebPage_ID FROM Owner_WebPages (WHERE WebPage_ID='$WID')" );
$PropertyID_check     = mysql_num_rows($sql_PropertyID_check);
$WebPageID_check      = mysql_num_rows($sql_WebPageID_check);
$OwnerID_check        = mysql_num_rows($sql_OwnerID_check);
if( ($OwnerID_check > 0) || ($PropertyID_check > 0) || ($WebPageID_check > 0) )
{
    include 'WPActivator.html';
    exit ();
}


include 'db.php'; ### You're including it again here?  Why?

$sql = mysql_query( "INSERT INTO WPVCode
                    (Owner_ID, Property_ID, WebPage_ID)
                    VALUES
                    ('$OID', '$PID', '$WID')" ) or die( mysql_error() );

if( !$sql )
{
   echo 'There has been an error creating your account. Please contact the webmaster.';
}
else
{
   echo ( "<p>Data Inserted Correctly</p>" );
}
### } Seems to be an EXTRA closing curly brace!  And you don't need the next 2 lines (see your code example above)

includ 'db.php'; ### TYPO 'includ' plus why are you including it again for the third time?

$sql2 = mysql_query (
                      "UPDATE Properties SET (Activated ='1')
                      WHERE (Property_ID='$PID' AND Owner_ID='$OID'
                      AND WebPage_ID='$WID')" ) or die (mysql_error)()); ### <-- Extra closing bracket here

if(!$sql2){
    echo 'There has been an error creating your account. Please contact the webmaster.';
} else {
   
echo ("<p> Data Modified Correctly</p>");


}
?> 


I didn't check your SQL... once you made the changes you can post again with the new errors if any.
 
 

Recent GIDBlog2nd Week of IA Training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to load any games after BIOS update lizard- Computer Hardware Forum 6 07-Jan-2004 08:23
update problem zuzupus MySQL / PHP Forum 2 15-Aug-2003 07:00

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 15:16.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.