468,140 Members | 1,428 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,140 developers. It's quick & easy.

How to change a field content in a database for the search engine

10
hello

I am doing a search engine for a library and I would like to offer the users the possibility of choosing a kind of document (video, audio, music sheet...) thanks to a check box . But the problem is that the kind of document in the database MySQL is named by an abbreviation (like "AV" for a a Video), which should not be seen on the result page. I would like that the full name "Video" is seen on the result page instead.
But I can´t find out how I can write that code.

I wrote that but it doesn´t work
Expand|Select|Wrap|Line Numbers
  1. if($_POST[`doc´]=="Video") {$sql="SELECT Tipo_de_documento FROM tablabu LIKE "AV") }
[Please use CODE tags when posting source code. Thanks! --pbmods]

Thanks for your help
Jun 20 '07 #1
2 1083
pbmods
5,821 Expert 4TB
You posted this in the PHP Articles forum. I'll go ahead and move it to the PHP Forum so that you'll get some responses....
Jun 21 '07 #2
pbmods
5,821 Expert 4TB
Heya, Phaelle.

Expand|Select|Wrap|Line Numbers
  1. if($_POST[`doc´]=="Video") {
  2.     $sql="SELECT Tipo_de_documento FROM tablabu LIKE "AV")
  3. }
You'll be wanting to change that to:

Expand|Select|Wrap|Line Numbers
  1. $sql = "SELECT `Tipo_de_documento` FROM `tablabu` WHERE `docTypeOrWhateverYouCalledIt` = 'AV'";
  2.  
Using LIKE is overkill, and you need to match against a field name. Also, you will want to put single quotes around 'AV' because you're using double quotes to set the value of $sql.
Jun 21 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Ian N | last post: by
reply views Thread by TaeHo Yoo | last post: by
2 posts views Thread by Jennyfer J Barco | last post: by
64 posts views Thread by Manfred Kooistra | last post: by
3 posts views Thread by sql | last post: by
27 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.