...

View Full Version : Syntax help required



wudz
01-04-2006, 08:23 PM
Hi.
I am a newbie at PHP and have tried to update a column in the logged in users temp_credit, I get no errors, but more importantly do not get an update...what am I missing other than brains..... ;)


$intro_id = ($_SESSION["PHPAUCTION_LOGGED_IN"]);
$query = "UPDATE PHPAUCTION_users SET temp_credit=3 WHERE id ='$intro_id'";

Thanks in anticipation

John

eksob
01-04-2006, 08:30 PM
did you try:


$intro_id = $_SESSION["PHPAUCTION_LOGGED_IN"];

also echo it out make sure your getting results,

and query the mysql update

bcarl314
01-04-2006, 08:44 PM
Hmm,

Well, you might want to add some debugging logic.

Try this...



$intro_id = ($_SESSION["PHPAUCTION_LOGGED_IN"]);
$query = "UPDATE PHPAUCTION_users SET temp_credit=3 WHERE id ='$intro_id'";
$rs = mysql_query($query) or die("Could not execute query:" . mysql_error());


The important thing is the "or die" part of the last line. It should tell you if there's a problem with the query (from mysql's perspective).

Prikid
01-04-2006, 10:27 PM
have you tried to start the session as the very first line on the page?


<?
session_start();
...
?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum