searching for multiple columns mysql and php

Posted by addi on Stack Overflow See other posts from Stack Overflow or by addi
Published on 2010-05-24T21:59:04Z Indexed on 2010/05/24 22:01 UTC
Read the original article Hit count: 229

Filed under:
|
|

i'm trying to search for multiple columns using this code:

 <?php

 // Connection Database
 $search = $_POST ['Search'];

mysql_connect("xxxxxx", "xxxxxx", "xxxxx") or die ("Error Connecting to Database");
mysql_select_db("xxxxx") or die('Error');
    $data = mysql_query("SELECT CourseName, CourseDescription, CourseLeader FROM course   MATCH (CourseName, CourseDescription, CourseLeader) AGAINST ('". $search ."')
or die('Error');
Print "<table border cellpadding=3>";
while($info = mysql_fetch_array( $data ))
 {
  Print "<tr>";
  Print "<th>Course Name:</th> <td>".$info['CourseName'] . "</td> ";
  Print "<th>Course Description:</th><td>".$info['CourseDescription'] . "</td> ";
  Print "<th>Course Leader:</th><td>".$info['CourseLeader'] . " </td></tr>";

  }
  Print "</table>";

   ?>

i'm getting the following error: Parse error: syntax error, unexpected T_STRING in /home/a7105766/public_html/website/scripts/coursesearchdb.php on line 30

what am I doing wrong??

cheers

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql