Jump to content
Larry Ullman's Book Forums

Pasting Example Code


bnorcom
 Share

Recommended Posts

I tried to paste a short example of code from a text file so I didn't have to type it all in but the paste options in the header don't work and the method of getting it from the clipboard doesn't work either.  Without an example accompanying the forum question there isn't enough information for someone to adequately answer.

Link to comment
Share on other sites

Okay, could someone elaborate on what is/isn't working? What is happening? etc.?

 

$q = 'SELECT user_id FROM access_tokens WHERE token=? AND date_expires > NOW()';
$stmt = mysqli_prepare($dbc, $q);
mysqli_stmt_bind_param($stmt, 's', $token);
mysqli_stmt_execute($stmt);
mysqli_stmt_store_result($stmt);
if (mysqli_stmt_num_rows($stmt) === 1) {
mysqli_stmt_bind_result($stmt, $user_id);
mysqli_stmt_fetch($stmt);


// Create a new session ID:
session_regenerate_id(true);
$_SESSION['user_id'] = $user_id;


// Clear the token:
$q = 'DELETE FROM access_tokens WHERE token=?';
$stmt = mysqli_prepare($dbc, $q);
mysqli_stmt_bind_param($stmt, 's', $token);
mysqli_stmt_execute($stmt);

Just pasted ^

Link to comment
Share on other sites

Hi Larry,

 

When I try and paste into the post, nothing will paste.  I tried within code tags and with no code tags.  I tried with right click paste and nothing pastes. I tried with the past button on top of the post box, but again, nothing pastes. There is no error message.

 

My environment is IE11 within Windows 7 64 bit.

 

Thanks.

Link to comment
Share on other sites

  • 2 weeks later...
  • 7 months later...

Test code paste with the code start and end:

 

while($row_outputs=mysqli_fetch_array($run_projects))
	{	// opening while loop
	
		$prog_name = $row_outputs['prog_name']; 
		$proj_name = $row_outputs['name'];
		$projectId = $row_outputs['id'];
		$proj_array = array($projectId); 
		$proj_array_uni = array_unique($proj_array);  
		$projecty = ''; 
	
		foreach($proj_array as $projectile)
			{
				
				$projectile = trim($projectile);
                                etc...
this indicates that it will paste correctly in 'Preview' - let's see if it does when I post it.
Link to comment
Share on other sites

 Share

×
×
  • Create New...