Proszę o szybką odpowiedź!
Kod
<?
/*
This script is set up specifically for me so some things will need changing.
I made this script because there is a lack of good mysql serching scripts out there.
*/
if($_POST['good']=='yes')
{
echo("<font face=\"tahoma\" size=\"3\" color=\"green\"><b>Results for $words</b></font>
");
$location = "localhost"; // database host (localhost)
$username = "root"; // mysql username
$password = "krasnal"; //mysql password
$database = "daggi"; //mysql database name
$db_table = "akutalnosci_komentarze"; // mysql table name to search
$mysql_row = "akutalnosci_komentarze"; // This is the row in your mysql database that you want to search for text in.
$conn = mysql_connect("$location","$username","$password");
if (!$conn) die ("Could not connect MySQL");
mysql_select_db($database,$conn) or die ("Could not open database");
$query = "ALTER TABLE $db_table ORDER BY id DESC";
$result = mysql_query($query); // bad coding yes;)
$query = "SELECT * FROM $db_table";
$result = mysql_query($query);
$numrows = mysql_num_rows($result);
while($row = mysql_fetch_array($result)){
if(preg_match("/$words/i", $row[$mysql_row]))
{
/*
event_id
event_date
event_venue
event_headline
event_town
are all rows in my mysql table. You must replace them with your own rows / rows
*/
$rawid = ($row[event_id]);
$rawmonth = ($row[event_date]); //yes strange variable names. It works so it doesnt matter.
$rawdate = ($row[event_venue]); //T just grab extra data to be added with the search tool
$rawyear = ($row[event_headline]);
$newnews = preg_replace("/$words/i", "<b><font color=\"red\">$words</font></b>", $row[$mysql_row]);
$display = '<font face="tahoma" size="2"><b>' .$rawmonth . ' ' . $rawdate . ', ' . $rawyear . '</b>
' . $newnews . '</font>
';
echo($display);
$foundcount++;
}
$totalcount++;
}
if(is_null($foundcount)){$foundcount=0;}
echo("<font face=\"tahoma\" size=\"3\" color=\"green\"><b>Found $foundcount entries out of $totalcount</b></font>");
}
?>
/*
This script is set up specifically for me so some things will need changing.
I made this script because there is a lack of good mysql serching scripts out there.
*/
if($_POST['good']=='yes')
{
echo("<font face=\"tahoma\" size=\"3\" color=\"green\"><b>Results for $words</b></font>
");
$location = "localhost"; // database host (localhost)
$username = "root"; // mysql username
$password = "krasnal"; //mysql password
$database = "daggi"; //mysql database name
$db_table = "akutalnosci_komentarze"; // mysql table name to search
$mysql_row = "akutalnosci_komentarze"; // This is the row in your mysql database that you want to search for text in.
$conn = mysql_connect("$location","$username","$password");
if (!$conn) die ("Could not connect MySQL");
mysql_select_db($database,$conn) or die ("Could not open database");
$query = "ALTER TABLE $db_table ORDER BY id DESC";
$result = mysql_query($query); // bad coding yes;)
$query = "SELECT * FROM $db_table";
$result = mysql_query($query);
$numrows = mysql_num_rows($result);
while($row = mysql_fetch_array($result)){
if(preg_match("/$words/i", $row[$mysql_row]))
{
/*
event_id
event_date
event_venue
event_headline
event_town
are all rows in my mysql table. You must replace them with your own rows / rows
*/
$rawid = ($row[event_id]);
$rawmonth = ($row[event_date]); //yes strange variable names. It works so it doesnt matter.
$rawdate = ($row[event_venue]); //T just grab extra data to be added with the search tool
$rawyear = ($row[event_headline]);
$newnews = preg_replace("/$words/i", "<b><font color=\"red\">$words</font></b>", $row[$mysql_row]);
$display = '<font face="tahoma" size="2"><b>' .$rawmonth . ' ' . $rawdate . ', ' . $rawyear . '</b>
' . $newnews . '</font>
';
echo($display);
$foundcount++;
}
$totalcount++;
}
if(is_null($foundcount)){$foundcount=0;}
echo("<font face=\"tahoma\" size=\"3\" color=\"green\"><b>Found $foundcount entries out of $totalcount</b></font>");
}
?>
jeszcze chcialbym sie dowiedzieć co oznacza wyrażenie : mysql_row