Jump to content

Inserting in to a database


dmccabe

Recommended Posts

You can escape some characters by putting a '\' in front of them.

 

For example:

 

echo 'You can't do this.';

 

Would bring up an error, but if you do this, it will work:

 

echo 'You can\'t do this.';

 

When you view the text it will show up as: You can't do this.

Thanks proteus, but how do I add the slashes if that value is being read from a file?

 

The whole thing:

 

HKUS\S-1-5-19\..\Run: [startUp This] "C:\Program Files\Laplink\PCmover\LaunchSt.exe" (User 'LOCAL SERVICE')

 

Is read in from a txt file and then each line is put in to a variable?

you use the mysql database functions..

 

example

 

<?php

// addslashes()

// stripslashes()

// mysql_real_escape_string()

//example.

//Making database posted variables safe for a mysql database.

$redarrow=addslashes($_POST['redarrow']);
$redarrow=stripslashes($_POST['redarrow']);
$redarrow=mysql_real_escape_string($_POST['redarrow']);

?>

Archived

This topic is now archived and is closed to further replies.

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