|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Help on PHP search engine
Hi, I'm doing a search engine using PHP for a project and I keep getting Parse errors on line 34 . Can anyone help me fix this particular error or any other errors that you see? Thank you very much!
Below is my code. <?php include ("mysql_connect.inc"); print ("Please search by artiste or song name."); function search_form($category_id) { global $root_category_id, $PHP_SELF; /*if the search artiste is not given, we default to the root category ID*/ if (!isset($category_id)) $category_id = $root_category_id; ?> <CENTER> <FORM METHOD="POST" ACTION="<?php echo $PHP_SELF?>"> <INPUT TYPE="HIDDEN" NAME="action" VALUE="show_list"> <INPUT TYPE="HIDDEN" NAME="search_on" VALUE="1"> /*Textbox*/ Search: <INPUT TYPE="TEXT" NAME="keywords" SIZE="20"><SELECT NAME="search_category" SIZE="1"> <INPUT TYPE="SUBMIT" VALUE="Search"> </FORM> </CENTER> <?php } /*Connect to the database*/ $adb = new DBI($dbstr, $cfg_dbuser, $cfg_dbpasswd); mysql_select_db("radio"); function get_fulltext_key($table,$db_connect){ global $radio; mysql_select_db($mysqldb,$db_connect); /* grab all keys of db.table */ $indices=mysql_query("SHOW INDEX FROM $table",$db_connect); or die(mysql_error()); $indices_rows=mysql_num_rows($indices); /* grab only fulltext keys */ for($nth=0;$nth<$indices_rows;$nth++){ $nth_index=mysql_result($indices,$nth,'Comment'); if($nth_index=='FULLTEXT'){ $match_a[].=mysql_result($indices,$nth,'Column_name'); } } /* delimit with commas, implode takes an existing array as its arguement */ $match=implode(',',$match_a); return $match; } ?> Last edited by shattered : March 3rd, 2003 at 12:24 PM. |
|
#2
|
||||
|
||||
|
Which line is line 34?
PHP Code:
|
|
#3
|
|||
|
|||
|
Hi there,
Thanks for your reply. Assuming that I'm using $adb to connect mysql with php, what should I change in my codes? Thanks for helping this hopeless PHP beginner! ![]() |
|
#4
|
||||
|
||||
|
You didn't answer my question. Which line is line 34?
|
|
#5
|
|||
|
|||
|
Hi,
Line 34 is mysql_select_db($mysqldb,$db_connect);. That error was fixed yesterday, because I was missing a ";" somewhere up the code. Now that I've added the missing ";", new errors appeared. "Warning: Failed opening 'mysql_connect.inc' for inclusion (include_path='.:/usr/share/pear') in /home/omis107/search.php on line 5" "Fatal error: Cannot instantiate non-existent class: dbi in /home/omis107/search.php on line 31" |
|
#6
|
||||
|
||||
|
For security reasons, the "mysql_connect.inc" file needs to end with a .php extension. Rename it either mysql_connect.inc.php or just mysql_connect.php -- and don't forget to make the appropriate change in the script itself either. As for your error on line 5, the include() error, they way you have it written that file must be in the same file as the script including it. If it is, then the problem is a parse error in the mysql_connect file itself.
As for the DBI problem -- I thought that looked strange -- you have to include() a class named DBI. Did you do that? |
![]() |
| Viewing: Dev Shed Forums > Other > Beginner Programming > Help on PHP search engine |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|