Help - Search - Member List - Calendar
Full Version: why does this not work...pulling my hair out.....
WorkTheWeb Forums > Webmaster Resources > PHP Help
Support our Sponsors!
toedipper
Hi,

The code below is part of an insert.

It inserts ok but the value for the last field userid is always written
back as blank. The userid should be filled from the session id
$_SESSION[MM_Username]

Any ideas? On the same page that this is on I can echo
$_SESSION[MM_Username] and that works ok.

Thanks,

td.



$insertSQL = sprintf("INSERT INTO software (title, shortdesc, `desc`,
version, minreqs, wareid, catid, hpage, dllink, dlsize, triallength,
price, keywords, liveyn, submitdate, submittime, userid) VALUES (%s, %s,
%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, 'N', current_date(),
current_time(), '$_SESSION[MM_Username]')",
GetSQLValueString($_POST['title'], "text"),
GetSQLValueString($_POST['shortdesc'], "text"),
GetSQLValueString($_POST['desc'], "text"),
GetSQLValueString($_POST['version'], "text"),
GetSQLValueString($_POST['minreqs'], "text"),
GetSQLValueString($_POST['wareid'], "int"),
GetSQLValueString($_POST['catid'], "int"),
GetSQLValueString($_POST['hpage'], "text"),
GetSQLValueString($_POST['dllink'], "text"),
GetSQLValueString($_POST['dlsize'], "text"),
GetSQLValueString($_POST['triallength'], "text"),
GetSQLValueString($_POST['price'], "double"),
GetSQLValueString($_POST['keywords'], "text"));

Stefan Rybacki
toedipper wrote:
QUOTE
Hi,

The code below is part of an insert.

It inserts ok but the value for the last field userid is always written
back as blank.  The userid should be filled from the session id
$_SESSION[MM_Username]

Any ideas?  On the same page that this is on I can echo
$_SESSION[MM_Username] and that works ok.

Thanks,

td.




Hey,

may you want to try this:

$insertSQL = sprintf("INSERT INTO software (title, shortdesc, `desc`,
version, minreqs, wareid, catid, hpage, dllink, dlsize, triallength,
price, keywords, liveyn, submitdate, submittime, userid) VALUES (%s, %s,
%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, 'N', current_date(),
current_time(), '%s')",
GetSQLValueString($_POST['title'], "text"),
GetSQLValueString($_POST['shortdesc'], "text"),
GetSQLValueString($_POST['desc'], "text"),
GetSQLValueString($_POST['version'], "text"),
GetSQLValueString($_POST['minreqs'], "text"),
GetSQLValueString($_POST['wareid'], "int"),
GetSQLValueString($_POST['catid'], "int"),
GetSQLValueString($_POST['hpage'], "text"),
GetSQLValueString($_POST['dllink'], "text"),
GetSQLValueString($_POST['dlsize'], "text"),
GetSQLValueString($_POST['triallength'], "text"),
GetSQLValueString($_POST['price'], "double"),
GetSQLValueString($_POST['keywords'], "text"),
$_SESSION['MM_Username']);


Stefan


PHP Help | Linux Help | Web Hosting | Reseller Hosting | SSL Hosting
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2006 Invision Power Services, Inc.