Jump to content



Photo

Pasting Example Code


  • Please log in to reply
10 replies to this topic

#1 bnorcom

bnorcom

    Member

  • Members
  • PipPip
  • 20 posts

Posted 27 September 2016 - 1:14 PM

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.


  • 0

#2 Larry

Larry

    Administrator/Writer

  • Administrators
  • 4785 posts
  • LocationState College, PA (USA)

Posted 28 September 2016 - 9:19 AM

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!


  • 0

#3 Necuima

Necuima

    Advanced Member

  • Members
  • PipPipPip
  • 255 posts
  • LocationSunshine Coast, Queensland, Australia

Posted 29 September 2016 - 1:05 AM

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, 29 September 2016 - 1:06 AM.

  • 0

#4 Larry

Larry

    Administrator/Writer

  • Administrators
  • 4785 posts
  • LocationState College, PA (USA)

Posted 29 September 2016 - 12:49 PM

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 ^


  • 0

#5 Necuima

Necuima

    Advanced Member

  • Members
  • PipPipPip
  • 255 posts
  • LocationSunshine Coast, Queensland, Australia

Posted 29 September 2016 - 11:55 PM

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.


  • 0

#6 Larry

Larry

    Administrator/Writer

  • Administrators
  • 4785 posts
  • LocationState College, PA (USA)

Posted 30 September 2016 - 10:27 AM

Thanks for the additional explanation. That is very strange! Can you drag and drop text into the window?


  • 0

#7 Necuima

Necuima

    Advanced Member

  • Members
  • PipPipPip
  • 255 posts
  • LocationSunshine Coast, Queensland, Australia

Posted 30 September 2016 - 11:49 PM

Trying a drag and drop...

 

No - that doesn't work either.


  • 0

#8 Larry

Larry

    Administrator/Writer

  • Administrators
  • 4785 posts
  • LocationState College, PA (USA)

Posted 14 October 2016 - 8:36 PM

Yeesh! No idea why you're seeing that. 


  • 0

#9 Necuima

Necuima

    Advanced Member

  • Members
  • PipPipPip
  • 255 posts
  • LocationSunshine Coast, Queensland, Australia

Posted 13 June 2017 - 3:04 AM

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.
  • 0

#10 Necuima

Necuima

    Advanced Member

  • Members
  • PipPipPip
  • 255 posts
  • LocationSunshine Coast, Queensland, Australia

Posted 13 June 2017 - 3:06 AM

Yep - beauty:-)

Cheers
  • 0

#11 Larry

Larry

    Administrator/Writer

  • Administrators
  • 4785 posts
  • LocationState College, PA (USA)

Posted 14 June 2017 - 2:46 PM

Whohoo!


  • 0