chcę zrobić by ".$results['nazwa']." stało się nazwą hiperłącza do ".$results['id']." lecz nie potrafię próbowałem już chyba każdej kombinacji ;/
Za każdym razem wybija mi błąd..
Proszę o pomoc
echo "<p><h3><a href="wynalazca.php?id='".$results['id']."'">".$results['nazwa']."</a></h3>".$results['tresc']."</p>";
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/.....
<head> <meta http-equiv="Content-type" content="text/html; charset=ISO-8859-2" /> </head> <form action="szukaj.php" method="GET"> <input type="text" name="s" /> <input type="submit" value="Szukaj" /> </form> <?php /* localhost - it's location of the mysql server, usually localhost root - your username third is your password if connection fails it will stop loading the page and display an error */ /* tutorial_search is the name of database we've created */ ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Search results</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="style.css"/> </head> <body> <?php $query = $_GET['s']; // gets value sent over search form $min_length = 3; // you can set minimum length of the query if you want // changes characters used in html to their equivalents, for example: < to > // makes sure nobody uses SQL injection // * means that it selects all fields, you can also write: `id`, `title`, `text` // articles is the name of our table // '%$query%' is what we're looking for, % means anything, for example if $query is Hello // it will match "hello", "Hello man", "gogohello", if you want exact match use `title`='$query' // or if you want to match just full word so "gogohello" is out use '% $query %' ...OR ... '$query %' ... OR ... '% $query' // $results = mysql_fetch_array($raw_results) puts data from database into array, while it's valid it does the loop //echo "<p><h3>".$results['title']."</h3>".$results['text']."</p>"; //<a href="wynalazca.php?id='.$rekord[0].'">'.$rekord[1].'</a> // posts results gotten from database(title and text) you can also show id ($results['id']) } } else{ // if there is no matching rows do following } } else{ // if query length is less than minimum } ?> </body> </html>