drapet Posted January 12, 2011 Share Posted January 12, 2011 hello I have a problem with php mysql search script. The script works great, only the inability to link results with page. script looks like this: <form action="rezult.php" method="post"> Search: <input type="text" name="term" /><br /> <input type="submit" name="submit" value="Submit" /> <?php mysql_connect ("localhost", "user","pass") or die (mysql_error()); mysql_select_db ("name"); $term = $_POST['term']; $sql = mysql_query("select * from radio where titel like '%$term%'"); while ($row = mysql_fetch_array($sql)){ echo 'ID: '.$row['ID']; echo '<br/> Radio '.$row['titel']; echo '<br/> '.$row['grad']; echo '<br/> '.$row['Beschrijving']; echo '<br/><br/>'; } ?> I have to link the result with a link: <a href = "http: / / domain.com / sender / '. $ row [' ID']/'.$ row ['titel']. html"> Radio '. $ row [' titel '] </ a> help!!!! regards Quote Link to comment https://forums.phpfreaks.com/topic/224193-search-mysql-script-help/ Share on other sites More sharing options...
Pikachu2000 Posted January 12, 2011 Share Posted January 12, 2011 You mean like this? echo "<a href=\"http://domain.com/sender/{$row['ID']}/{$row['titel']}.html\">Radio {$row['titel']}</a>"; Quote Link to comment https://forums.phpfreaks.com/topic/224193-search-mysql-script-help/#findComment-1158395 Share on other sites More sharing options...
Maq Posted January 12, 2011 Share Posted January 12, 2011 What's the exact issue you're running into? You have the right idea and you need to echo it out. Quote Link to comment https://forums.phpfreaks.com/topic/224193-search-mysql-script-help/#findComment-1158396 Share on other sites More sharing options...
drapet Posted January 12, 2011 Author Share Posted January 12, 2011 When I try to link like this echo '<br/><a href = "http://domain.com/sender/'.$row['id']/'.$row['titel'].html">Radio '.$row['titel']</a>; echo '<br/>'.$row['grad']; echo '<br/>'.$row['beschrijving']; echo '<br/><br/>'; I get an error: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in *************/result.php on line 13 the same line where is the link code Quote Link to comment https://forums.phpfreaks.com/topic/224193-search-mysql-script-help/#findComment-1158498 Share on other sites More sharing options...
Maq Posted January 12, 2011 Share Posted January 12, 2011 Close, you had your quotes mixed up I think. This should work: echo " Radio {$row['titel']}"; Quote Link to comment https://forums.phpfreaks.com/topic/224193-search-mysql-script-help/#findComment-1158503 Share on other sites More sharing options...
drapet Posted January 12, 2011 Author Share Posted January 12, 2011 the same string when I try as you and Pikachu2000 said. scripta works perfectly with no link code. I have no clue Quote Link to comment https://forums.phpfreaks.com/topic/224193-search-mysql-script-help/#findComment-1158511 Share on other sites More sharing options...
drapet Posted January 12, 2011 Author Share Posted January 12, 2011 when i sent to you, I am confused quotes, but on site is ok. Quote Link to comment https://forums.phpfreaks.com/topic/224193-search-mysql-script-help/#findComment-1158512 Share on other sites More sharing options...
drapet Posted January 12, 2011 Author Share Posted January 12, 2011 sory i leave to echo.. now its o.k. THANKS A LOT Quote Link to comment https://forums.phpfreaks.com/topic/224193-search-mysql-script-help/#findComment-1158514 Share on other sites More sharing options...
Maq Posted January 12, 2011 Share Posted January 12, 2011 sory i leave to echo.. now its o.k. THANKS A LOT Hmmm..... ok good. Quote Link to comment https://forums.phpfreaks.com/topic/224193-search-mysql-script-help/#findComment-1158530 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.