Jump to content

Puzzling Problem With Function Variable


westonm

Recommended Posts

I have been having a problem with a very simple function for about the last 6 hours and it is getting real frustrating. I am quite sure it is a very simple something I am overlooking but I don't see it. If someone could point me in the right direction I would greatly appreciate it. The code is in the attached file: The problem is that I am passing a value of "MaynardWestonA" which is a key to a SQL table. In the function I want to update the record for "MaynardWestonA" but it keeps seeing only "Mayna" in the function- it is dropping the rest of the variable and consequently not finding the record.

function updtRegis($keyin) {

UPDATE directory SET username='', password='', registered='Yes' WHERE key = $keyin ;

}

The main program calls the function as follows:

$keypass = 'MaynardWestonA'

...

rtnvalue2 = updtRegis($keypass);

UpdateSnip.txt

Link to comment
Share on other sites

Sorry - I thought the basics idea would be enough - The actual code is

function updtRegist($keyin, $database_Class63, $Class63) {
require_once('Connections/Class63.php');
mysql_select_db($database_Class63, $Class63);
$updateSQL = sprintf("UPDATE 'directory' SET 'USERNAME'='','PASSWORD'='','Registered'='Yes' WHERE 'KEY'=%s",
	    GetSQLValueString($keyin, "text"));  
$Result1 = mysql_query($updateSQL, $Class63) or die(mysql_error());		   
}

The calling code is

$rtnval2 = updtRegist($keypass, $database_Class63, $Class63);

Why can't I do a line feed here? This is just the function and the calling code.

Link to comment
Share on other sites

Barand - Thanks this seemed to help, it passed the full value of the variable. Didn't update the table but I am a step closer now, at least it is not giving me an error. I have always had a problem with single and double quotes and when to use them or not. Actually had to leave the single quotes on KEY and not put them on %s. I think it needs them on KEY since that is a reserved name. Thanks again, now I can find the next problem.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.