Jump to content

Recommended Posts

Hello again

 

here is my code but its dont work correct

 

$super = $_GET['video_id'];
        $filmai = $TSUE['TSUE_Database']->query("SELECT rasta_cinema.video_id, rasta_cinema.name, rasta_cinema.description, rasta_cinema.video_name, rasta_cinema.thumb_image FROM rasta_cinema WHERE video_id = $super LIMIT 1");
        

 

 

error im get is

 

Database Error!
Please try again later or contact an Administrator.
(1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 1' at line 1 SELECT rasta_cinema.video_id, rasta_cinema.name, rasta_cinema.description, rasta_cinema.video_name, rasta_cinema.thumb_image FROM rasta_cinema WHERE video_id = LIMIT 1

 

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/260453-having-problem-with-_get/
Share on other sites

Put quotes around the variable.

 

WHERE video_id = '$super' LIMIT 1

 

Also, don't stick user input into your database like that or you will be vulnerable to SQL injection. I don't know what you're using to connect to the database so I can't offer any specifics.

Scootstah beat me to it here, but he's correct on one account.

Since $super is passed from the query string, it is type string.

So either cast it to an int or use intval() to sanitize the data.

and be consistent with field qualifiers.

 

$super = intval($_GET['video_id']);
        $filmai = $TSUE['TSUE_Database']->query("SELECT rasta_cinema.video_id, rasta_cinema.name, rasta_cinema.description, rasta_cinema.video_name, rasta_cinema.thumb_image FROM rasta_cinema WHERE rasta_cinema.video_id = $super LIMIT 1");

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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