Jump to content

Help sql select...


ivanella

Recommended Posts

I guys, i'm sorry for my english but i'm italian girl.

 

I need help for this script:

 

$sql = "SELECT link_title FROM film_links WHERE '{$attori}' LIKE CONCAT( '%', link_field6, '%' )";

 

it dosnt work, do you know why???

 

thanks for help....

Link to comment
Share on other sites

ivanella: Did you try my example? Did it work?

 

Rohan Shenoy:

 

Yes, and it's always good to try everything possible and get everyones ideas. More brains are better then one.

 

Note: If you want to get really, really, really, really, technical, there are 5 indications that the name 'attori' is a PHP variable and none of those 5 indicators appear on the 'link_field6' fieldname. Those find indicators are left and right single quotes, left and right curly brackets and the dollar sign. A SQL field name would not be quoted in a situation like this, would never have the curly brackets or the dollar sign. So if the person writing this code put all of those characters in on one PHP variable that indicated it was a PHP variable, there is a good chance that they would also at least include 1 of those indicators on the 'link_field6' name.  Also the word 'field' appears in 'link_field6' which also suggests that could be a SQL field name.

 

 

 

 

 

Link to comment
Share on other sites

If your $attori variable contains multiple names like you mentioned, you can replace all of the spaces between the names with '%' before using it in the SQL query, so that it would match each word in it rather then the whole string.

 

<?php
$attori = str_replace(' ', '%', $attori);
?>

Link to comment
Share on other sites

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.