-6

this is so that when I lie a link into my database then tag / download video and lie it on the page like this

so when it is that I lie it into the database so it's going to look like this in the database, and I can not really figure out what is wrong since there doing this then to be \ into like it the link in php

show here:

this is how I think of it. However, I did not try anything. but here is my code for my site:

<tr>
                    <td>Video:</td>
                    <td><input type="text" name="video"></td>
                </tr>

and my code to all my infomation to youtube

if ($stmt = $this->mysqli->prepare("INSERT INTO `artiker` (`title`, `kort`, `video`, `tekst`, `img`, `img_title`) VALUES (?, ?, ?, ?, ?, ?)")) { 

            $stmt->bind_param('ssssss', $title, $kort, $video, $tekst, $img, $img_title);

            /* Sæt værdier på parametrene */
            $title = $_POST['title']; 
            $kort = $_POST['kort'];
            $video = $_POST['video'];
            $tekst = $_POST['tekst'];
            $img = $pb;
            $img_title = $_POST["img_title"];

            /* Eksekver forespørgslen */
            $stmt->execute();

            /* Luk statement */
            $stmt->close();

            ?>
            <script language="javascript" type="text/javascript">  
                window.location.href = "/artikler-programmering/";  
            </script> 
            <?php

        } else {
            /* Der er opstået en fejl */
            echo 'Der opstod en fejl i erklæringen: ' . $this->mysqli->error;
        }   

Really hope you can help me to not set \ into my youtube links

4

2 に答える 2

2

私の推測では、エスケープされた文字列を扱っていると思います... stripslashes() http://php.net/stripslashesを試してください:

$video = stripslashes($_POST['video']);
于 2013-01-01T22:22:05.363 に答える
0

Just a guess... After you retrieve the youtube link from the database, you will want to call stripslashes() on the video link.

What that function will do is transform:

https:\/\/www.youtube.com\/watch?v=RlfLCWKxHJ0

into

https://www.youtube.com/watch?v=RlfLCWKxHJ0
于 2013-01-01T22:26:07.070 に答える