larry777 Posted January 31, 2007 Share Posted January 31, 2007 Greetings, I'm trying to post the username into a table row... I can't get it to work!!! : ( Not sure what I'm doing wrong.. can you help...?? I'm banging my head against my desk!Cheers.***************************************$sql = "INSERT INTO filestore SET filename = '$uploadname', mimetype = '$uploadtype', description = '$uploaddesc', filedata = '$filedata', username = $_SESSION['MM_Username'] ";*************************************** Link to comment https://forums.phpfreaks.com/topic/36462-solved-inserting-username-into-mysql-table-row/ Share on other sites More sharing options...
Sir William Posted January 31, 2007 Share Posted January 31, 2007 You can't use the associative array call from within quotes, try this:$sql = "INSERT INTO filestore SET filename = '$uploadname', mimetype = '$uploadtype', description = '$uploaddesc', filedata = '$filedata', username = '".$_SESSION['MM_Username']."'";[i]Edit: forgot the ticks around the username.[/i] Link to comment https://forums.phpfreaks.com/topic/36462-solved-inserting-username-into-mysql-table-row/#findComment-173556 Share on other sites More sharing options...
larry777 Posted January 31, 2007 Author Share Posted January 31, 2007 Hey there,what did you mean about the ticks around the username? : ) Link to comment https://forums.phpfreaks.com/topic/36462-solved-inserting-username-into-mysql-table-row/#findComment-173561 Share on other sites More sharing options...
Sir William Posted January 31, 2007 Share Posted January 31, 2007 They're in there now. I edited it about 20 seconds after I posted. I was just saying why I edited.If $_SESSION['MM_Username'] = Joe then the query will be $sql = " ....... username = 'Joe' ". There should be ticks around the variable call in case the Username has spaces in it. Link to comment https://forums.phpfreaks.com/topic/36462-solved-inserting-username-into-mysql-table-row/#findComment-173563 Share on other sites More sharing options...
larry777 Posted January 31, 2007 Author Share Posted January 31, 2007 Bingo!! It worked... Nice one!Many many thanks.. U are the Man! Link to comment https://forums.phpfreaks.com/topic/36462-solved-inserting-username-into-mysql-table-row/#findComment-173570 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.