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 18-Mar-2004, 20:57
Dagma20 Dagma20 is offline
New Member
 
Join Date: Mar 2004
Posts: 3
Dagma20 is on a distinguished road

RE: Sessions stuff for a confused programmer


Hi all i have a problem with my coding, i have just started messing around with sessions and have come up with a /biggish problem that i am stumped on. The problem is, is i have got some variables and put them in the sessions buffer from a page which would be viewed about 2 pages previous to this one (part of a web page modification system). I then call these variables into a .php form and processes them as part of the WHERE conditions in an update table, the problem is that because the syntax for the sessions variables is :

PHP Code:

[b]".[/b]$_SESSION['asessonthingy'][b]."[/b] 



when i put this into the sql query statement it will not allow me to add the quotes at the end of thestatement like so below :

PHP Code:

$sql = mysql_query ("UPDATE Owner_WebPages SET Page_Title = '$Title', Property_Description = '$PD',  TCOLOUR = '$TCOLOUR', BG_Color_Code ='$BGR' WHERE Web_ID = ".$_SESSION['WebID']." AND WebPage_Password = ".$_SESSION['WebPwd']." [b]"[/b]  ) or die (mysql_error()); 



if i leave off the highlighted " to close the query it obviously has a go at me but when i put it on it chucks a parse error at me .

Has anyone got any ideas?

Here is the full script below :
-----------------

PHP Code:

<? 
// start the session 
session_start(); 
header("Cache-control: private"); //IE 6 Fix 
 
include 'db.php'; 

$Title = $_POST['Title']; 
$PD = $_POST['PD']; 
$TCOLOUR = $_POST['TCOLOUR'];  
$BGR = $_POST['BGR']; 


$sql = mysql_query ("UPDATE Owner_WebPages SET Page_Title = '$Title', Property_Description = '$PD',  TCOLOUR = '$TCOLOUR', BG_Color_Code ='$BGR' WHERE Web_ID = ".$_SESSION['WebID']." AND WebPage_Password = ".$_SESSION['WebPwd']."  ) or die (mysql_error()); 
  

if (!$sql) { 

    echo ("There has been an error creating your account. Please contact the webmaster."); 

} else { 

    echo ("Well done you made it here, you have successfully modified your webpage. To view your changes, click on the link below to take you back to the Menu and select View a Property"); 

    echo ("<a href=brgtest.php>Click here to view your page </a>");
} 
?> 

</body>
</html>

  #2  
Old 19-Mar-2004, 06:10
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
Hello Dagma20,

I have it set up in this forum that regular BBCodes are not parsed inside CODE type bb codes.

back to your issue -

Try this and see if it works... I don't know if you were type-casting when you created the session variables so I will guess NOT.

PHP Code:

<?php
// ...
$sql = mysql_query( "UPDATE Owner_WebPages
                    SET Page_Title = '$Title',
                    Property_Description = '$PD',
                    TCOLOUR = '$TCOLOUR',
                    BG_Color_Code ='$BGR'
                    WHERE Web_ID = '$_SESSION[WebID]'
                    AND WebPage_Password = '$_SESSION[WebPwd]'"
                  )
                  or die( mysql_error() );
// ....
?>

 
 

Recent GIDBlogToyota - 2009 May Promotion by Nihal

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

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

All times are GMT -6. The time now is 06:46.


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