I have a string which is a path and is a variable in which I have to save in my database. But the path is   C:\foldera\folderb\folder1\folder2   and obviously I need it to be   C:\\foldera\\folderb\\folder1\\folder2   for the insertion in database of mysql.  Please help me find the solution. I tried str_replace but it won't work. Thanks in advance.
73
If user input is inserted without modification into an SQL query, then the application becomes vulnerable to , like in the following example:  $unsafe_variable = $_POST['user_input'];   mysql_query("INSERT INTO `table` (`column`) VALUES ('$unsafe_variable')");   That's because the user can input something like value'); DROP TABLE table;--, and the query becomes:  INSERT INTO `table` (`column`) VALUES('value'); DROP TABLE table;--')   What can be done to prevent this from happening?
124212
I'm using the MySQL Query Browser (part of the ) and need to change a field to NULL, but I can't figure out how to do it - if I delete the value it tries to update it to ''. Typing "NULL" makes it try to update to 'NULL' (a string).  I know I could just write a query to do it, but that defeats the entire purpose of the tool, no?
13052
Path:  / DIRECTORY_ROOT        /SUB_DIRECTORY   And convert that to:  / directory_root        /sub_directory   I tried: rename 'y/A-Z/a-z/' * but it only changes the root directory and not sub directories. I'm new to Ubuntu, thanks for the help!
50152
Consider the following text (incidentally, part of a MySQL dump):   CREATE TABLE `table` (   `id` int(10) NOT NULL auto_increment,   `name` varchar(100) NOT NULL default '',   `description` text NOT NULL,   PRIMARY KEY  (`id`),   FULLTEXT KEY `full_index` (`name`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */;   I would like to remove the FULLTEXT key, and I also want to remove the trailing comma on the line above so that the SQL remains valid.  Can anyone come up with (and explain) a sed recipe to do this?
10301
I was wondering if there was an easy way in SQL to convert an integer to its binary representation and then store it as a varchar.  For example 5 would be converted to "101" and stored as a varchar.
42913
Is there a convenient way to rename a file (or dir) without redundantly repeating the path or directory-changing to it?  For example …  mv -some_flag db/migrations/abc_201911201243.php abc_20191101090000.php   … to rename the file without moving it out of that directory.  I looked into the man pages for mv, rename and rsync but didn't find anything, so I'm wondering if there is by chance a non-obvious trick to do this.
1770
Consider a database table holding names, with three rows:  Peter Paul Mary   Is there an easy way to turn this into a single string of Peter, Paul, Mary?
17089
I want to search in all fields from all tables of a MySQL database a given string, possibly using syntax as:  SELECT * FROM * WHERE * LIKE '%stuff%'   Is it possible to do something like this?
20999
Table structure: CREATE TABLE dblog_query_strings (     id          bigserial,     query_string        text NOT NULL,     PRIMARY KEY     (id),     UNIQUE          (query_string) )  CREATE TABLE dblog_file_paths (     id          bigserial,     file_path       text NOT NULL,     PRIMARY KEY     (id),     UNIQUE          (file_path) )  CREATE TABLE db_log (     id          bigserial,     logged_at       timestamptz NOT NULL DEFAULT now(),     query_string_id     bigint NOT NULL,     file_path_id        bigint NOT NULL,     seconds         numeric,     PRIMARY KEY     (id),     FOREIGN KEY     (query_string_id) REFERENCES dblog_query_strings (id) ON UPDATE CASCADE ON DELETE CASCADE,     FOREIGN KEY     (file_path_id) REFERENCES dblog_file_paths (id) ON UPDATE CASCADE ON DELETE CASCADE )  The application code, which is indeed run at the same time by many different scripts: $query_string = 'test query string'; $file_path = 'test path'; $seconds = 0.00065708160400391; dbcall('INSERT INTO dblog_query_strings (query_string) VALUES ($1) ON CONFLICT DO NOTHING', $query_string); dbcall('INSERT INTO dblog_file_paths (file_path) VALUES ($1) ON CONFLICT DO NOTHING', $file_path); dbcall('INSERT INTO db_log (query_string_id, file_path_id, seconds) VALUES (     (SELECT id FROM dblog_query_strings WHERE query_string = $1),     (SELECT id FROM dblog_file_paths WHERE file_path = $2), $3)', [ $query_string, $file_path, $seconds ]);  The SOMETIMES logged error, for example right when I clear the database log: pg_query_params(): Query failed: ERROR:  null value in column &quot;query_string_id&quot; violates not-null constraint DETAIL:  Failing row contains (1, 2020-08-27 00:37:32.419107+02, null, null, 0.00065708160400391).  Analysis: The third INSERT sometimes gets nulls for its SELECTs, instead of the expected strings. This should be logically impossible, regardless of whether I run one script or 10,000 scripts in parallel, because even if the other scripts INSERT at the same time, and all but the first one fail, this is built into my mechanism, as you can see. The first two queries simply INSERT values if they don't exist. It thus doesn't matter how many concurrent scripts are being run. By the time the third and final INSERT is executed, the table is guaranteed to have those values in it. Yet this is clearly not always the case! But I don't see how that is possible. At this point, I'm 99% convinced that I've somehow hit a bug in PostgreSQL, but I'd much rather have this be a mistake/confusion by me. I don't see any way which in which the third INSERT can possibly ever get null values from those SELECTs, given that the queries before make sure that the values exist, prior to it being executed. They are not &quot;asynchronous&quot; but executed sequentially, one by one. I've tried it like this and as a single transaction. Nothing helps from the dreaded &quot;magical&quot; race conditions or whatever is really happening here. This is how I &quot;clear the log&quot;: dbcall('BEGIN'); dbcall('TRUNCATE TABLE db_log RESTART IDENTITY CASCADE'); dbcall('TRUNCATE TABLE dblog_query_strings RESTART IDENTITY CASCADE'); dbcall('TRUNCATE TABLE dblog_file_paths RESTART IDENTITY CASCADE'); dbcall('COMMIT');  While that transaction is being executed, tons of scripts are doing the INSERTs, but this doesn't matter since they will either see the old tables or completely empty ones... right? So how can I get errors still?
68629
I am using PHP on my server to create a latex table from a database, which is working fine.  The problem I have now is getting that into my latex document.  I thought that giving it the path would allow it to get the file from the web and input it like normal but that doesn't work and I've been unable to find anything online about doing this sort of thing.  Here is an example of what I'm trying to accomplish:  \documentclass{article} \begin{document} \input{http://example.com/generated-latex.php} \end{document}
57130
How I can use a variable name in file path ?  ssl_certificate /home/ec2-user/.certificados/$server_name.crt; ssl_certificate_key /home/ec2-user/.certificados/$server_name.key;
32512
For various reasons, I'm stuck in Access 97 and need to get only the path part of a full pathname.  For example, the name  c:\whatever dir\another dir\stuff.mdb   should become  c:\whatever dir\another dir\   This site has some suggestions on how to do it:   But they seem rather hideous.  There must be a better way, right?
111951
The idea would be to use it as... a pipe in a command. For instance: say there's some kind of long path which has to be retyped again and again, followed by a pipe and a second program, i.e.  "directory1/directory2/direcotry3/file.dat | less -I "   I'd like that part to be stored in a variable, so it could be used like this:  r="directory1/directory2/direcotry3 \| less -I -p " $ cat path1/path2/$r &lt;searchterm&gt;   Instead, I get  cat: invalid option -- I Try `cat --help' for more information.   ... meaning the pipe clearly didn't work.
74148
Does anyone know of a program, a utility, or some programmatic library, preferably for Linux, that takes an unformatted SQL string and pretty prints it?  For example I would like the following  select * from users where name = 'Paul'   be changed to something like this  select *  from users where    name = 'Paul'   The exact formatting is not important. I just need something to take a large SQL string and break it up into something more readable.
5405
If I pass PHP variables with . in their names via $_GET PHP auto-replaces them with _ characters. For example:  &lt;?php echo "url is ".$_SERVER['REQUEST_URI']."&lt;p&gt;"; echo "x.y is ".$_GET['x.y'].".&lt;p&gt;"; echo "x_y is ".$_GET['x_y'].".&lt;p&gt;";   ... outputs the following:  url is /SpShipTool/php/testGetUrl.php?x.y=a.b x.y is . x_y is a.b.   ... my question is this: is there any way I can get this to stop? Cannot for the life of me figure out what I've done to deserve this  PHP version I'm running with is 5.2.4-2ubuntu5.3.
82706
What is the equivalent of varchar(max) in MySQL?
93580
I'm working with a MySQL database that has some data imported from . The data contains non- characters (em dashes, etc.) as well as hidden carriage returns or line feeds. Is there a way to find these records using MySQL?