Jump to content
bubbles

Problema Interogare SQL

Recommended Posts

Am urmatoarele probleme :

1.De exemplu la urmatorul link MOVIE daca mai adaug ceva dupa ultimul / imi arata practic index.php insa fara calea corecta a css-ului si pagina se deformeaza.

Cum pot anula chestia asta ?

Interogarea este urmatoarea

$result = mysqli_query($mysqli,"select * from video where id='$movie_id' and category_embed='$movie_cat' and title_movie='$movie_title'");

Iar in .htaccess am adaugat

RewriteRule ^video/([^/]*)/([^/]*)/([^/]*)/$ /video.php?category=$1&title=$2&video=$3 [L]

2. De ce daca mai adaug litere aici - /25xxxxxx/ tot se face interogarea ?

PS : Continutul este ADULT

Link to comment
Share on other sites

Sa inteleg ca ai modificat corespunzator .htaccess pentru a avea 4 "/". Ai modificat scriptul php si tot nu merge?

Asa merge?


RewriteRule ^video/([^/]*)/([^/]*)/([^/]*)/([a-z0-9]*)$ /video.php?category=$1&title=$2&video=$3 [L]

Edited by em
Link to comment
Share on other sites

Este OK.

Doar ca trebuie sa pastrezi si regula originala (nemodificata). O sa ai 2 acum.

Deci o sa ai asa


RewriteRule ^video/([^/]*)/([^/]*)/([^/]*)/$ /video.php?category=$1&title=$2&video=$3 [L]
RewriteRule ^video/([^/]*)/([^/]*)/([^/]*)/([a-z0-9]*)/$ /video.php?category=$1&title=$2&video=$3 [L]

Link to comment
Share on other sites

OK. Am inteles ce doresti. Dar ce mi-ai aratat tu nu prea e util.

Vezi in video.php parametrul $_GET['video']. Eu cred ca ii face cast la int (dac? exist? casturi in php, nu sunt sigur). Posteaza sursa paginii sau macar bucata de cod care se joaca cu parametrul ala.

Link to comment
Share on other sites

Salut.

Este vorba de type-conversion de la mysql. (O face automat ca sa iti fie tie mai bine).

De exemplu


mysql> SELECT 1 > '6x';
-> 0
mysql> SELECT 7 > '6x';
-> 1
mysql> SELECT 0 > 'x6';
-> 0
mysql> SELECT 0 = 'x6';
-> 1

Dupa cum vezi, cand am un numeric cu alt gunoi dupa el, si el se asteapta la numeric, nu tine cont de ultimele caractere.

  • Upvote 1
Link to comment
Share on other sites

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.   Paste as plain text instead

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