Jump to content
Larry Ullman's Book Forums
Sign in to follow this  
bnorcom

Pasting Example Code

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.

Share this post


Link to post
Share on other sites

I'm sorry, but I'm really not following what you're saying or what you're asking here. Could you please be more explicit? Thanks!

Share this post


Link to post
Share on other sites

I think this is the same issue that I have - trying to paste code into a forum post such as this one.

 

Thanks, Necuima.

Edited by Necuima

Share this post


Link to post
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 ^

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×