I am looking for my script to fix, it could first find a word in different tables. But in combination they did not. Now someone help me and said I had to implement this script:
Now I have no idea how I now get to work.<?
$searchQuery = '%$_POST[search]%' ;
$chunks = preg_split ( '#\s+#' , $searchQuery );
$ columns = Array ( 'label', 'type', 'price', 'doors',' color ',' year ',' weight ',' kmstand ',' fuel ',' MOT ',' engine content ',' transmission ',' guarantee ',' info ')
$clausule = '' ;
foreach( $chunks as $chunk ){
$searchType = 0 ;
if( $chunk [ 0 ] == '-' ){
$searchType = 1 ;
$chunk = substr ( $chunk , 1 );
}
$fields = Array();
foreach( $columns as $column ){
$fields [] = '(' . $column .( $searchType ? ' NOT' : '' ). ' LIKE \'%' . mysql_real_escape_string ( $chunk ). '%\')' ;
}
$clausule .= ( strlen ( $clausule )? ' AND' : ' ' ). ' (' . implode (( $seachType ? ' AND ' : ' OR ' ), $fields ). ') ' ;
}
?>
The rest of my existing script like this:
Can someone help me thank you<?
/ / - Execute the SQL code and put it in a variable so we are about to be
/ / - Check if there is a result
$ res = mysql_query ($ sql);
/ / - Check now or a result, the keyword is found or not
if (mysql_num_rows ($ res)> = 1)
(
/ / - A result, show the results via a while () loop
while ($ row = mysql_fetch_array ($ res))
(
echo "<br> <br> bgcolor=#999999 <table width=500 hight=auto> <tr> <td ALIGN=LEFT> Note: </ td> <td ALIGN=LEFT> <b>". $ row [ 'mark']. "</ b> </ td> </ tr> <tr> <td ALIGN=LEFT> Type: </ td> <td ALIGN=LEFT>. $ row [ 'type']. "</ td> </ tr> <tr> <td ALIGN=LEFT> Price: </ td> <td ALIGN=LEFT>. $ row [ 'price']. "</ td> </ tr> <tr> <td ALIGN=LEFT> Image: </ td> <td ALIGN=LEFT> <HR color=gray> <a target = _blank href = img /". $ row [ 'image']. "> <img border = 0 src = img / thumbs /". $ row [ 'image']. "> </ a> <HR color=gray> </ td> </ tr> <tr> <td ALIGN=LEFT> Number of doors: </ td> <td ALIGN=LEFT>. $ row [ 'doors']. "</ td> </ tr> <tr> <td ALIGN=LEFT> Color: </ td> <td ALIGN=LEFT>. $ row [ 'color']. "</ td> </ tr> <tr> <td ALIGN=LEFT> Year: </ td> <td ALIGN=LEFT>. $ row [ 'age']. "</ td> </ tr> <tr> <td ALIGN=LEFT> Weight: </ td> <td ALIGN=LEFT>. $ row [ 'weight']. "</ td> </ tr> <tr> <td ALIGN=LEFT> KMs: </ td> <td ALIGN=LEFT>. $ row [ 'kmstand']. "</ td> </ tr> <tr> <td ALIGN=LEFT> Fuel: </ td> <td ALIGN=LEFT>. $ row [ 'fuel']. "</ td> </ tr> <tr> <td ALIGN=LEFT> MOT: </ td> <td ALIGN=LEFT>. $ row [ 'MOT']. "</ td> </ tr> <tr> <td ALIGN=LEFT> Motor contents: </ td> <td ALIGN=LEFT>. $ row [ 'content engine']. "</ td> </ tr> <tr> <td ALIGN=LEFT> Transmission: </ td> <td ALIGN=LEFT>. $ row [ 'transmission']. "</ td> </ tr> <tr> <td ALIGN=LEFT> Warranty: </ td> <td ALIGN=LEFT>. $ row [ 'guarantee']. "</ td> </ tr> <tr> <td ALIGN=LEFT> Info: </ td> <td ALIGN=LEFT>. $ row [ 'info']. "</ td> </ tr> </ table> <br> <br> <img src=img\streep.jpg>";
)
echo "<br> <center> <a href=\"?p=auto\" title=\"zoe opnie\"> search again </ a> </ center>";
)
/ / - If no result is found, so if the keyword is not found:
else
(
echo "<br> <center> <p> Nothing found in your search: <b> $ _POST [query] </ b> </ p> </ center>";
echo "<br> <CENTER> <p> href=\"?p=auto\" title=\"zoe opnie\"> search again </ a> </ p> </ center>";
)
>
>


Reply With Quote

Bookmarks