Jump to content

how to structure a mysql DB and create a search engine for full site?


alapimba

Recommended Posts

Hello,

I'm about to create a site that has to be fully dinamic and needs a backend so the cliente can update the site by them self.
I'm thinking in use php and mysql because it's the only server side tecnology that i know a little bit.

But this site i'll need to do is very complex and i'm a bit afraid because don't know where to start specially because the search engine.

So far the only search engines i did had an option to choose where we wanted to search something. For example a book store, i can make it search for authors or search for books, and depending what the people choose, the result will be only based on books or only based on authors and have links to that section only.

But in my next project i have to create something more generalist and i'm stuck.

the code i had on my first project was this:
[code=php:0]<?php
if ($_POST['pesquisa'] == '' ){
echo "Por favor, escreva algo na pesquisa.";
}
else if($_POST['busca'] == 'Autor') {
if ($row_rs_autores['id'] == ''){
$palavra = $_POST['pesquisa'];
echo "<span class='style5'>Não foi encontrado nenhum autor com o nome</span><span class='style4'> $palavra </span><br>Tente novamente</br>";
}
else {
?>
<a href="autores.php?id=<?php echo $row_rs_autores['id'];?>" class="style4">:: <?php echo $row_rs_autores['nome']; ?> <?php echo $row_rs_autores['apelido']; ?></a>
<?php
echo "<br><br>";
while ($row_rs_autores = mysql_fetch_assoc($rs_autores)) {
?> <a href=" autores.php?id=<?php echo $row_rs_autores['id'];?>" class="style4"> :: <?php echo $row_rs_autores['nome']; ?> <?php echo $row_rs_autores['apelido']; ?></a>
<?php
echo "<br><br>";
}
}
}
else if ($_POST['busca'] == 'Livro'){
if ($row_rs_autores['id_li'] == ''){
$palavra = $_POST['pesquisa'];
echo "<span class='style5'>Não foi encontrado nenhum livro com as palavras</span><span class='style4'> $palavra </span> <br>Tente novamente</br>";
}
else {
?>
<a href="livros.php?id_li=<?php echo $row_rs_autores['id_li']; ?>" class="style4">:: <?php echo $row_rs_autores['livro']; ?></a>
<?php
echo "<br><br>";
while ($row_rs_autores = mysql_fetch_assoc($rs_autores)) {
?> <a href="livros.php?id_li=<?php echo $row_rs_autores['id_li']; ?>" class="style4">:: <?php echo $row_rs_autores['livro']; ?></a>
<?php
echo "<br><br>";
}
}
}
?>[/code]

As you see it link you to livros.php?id_li... if you choosed livros on the search engine but if you choosed autores it give results as autores.php?id...
but if i didn't wanted to choose anything and just type a word? it could search the complete database and gave me the id's but how to display it and if the result is on the database autores give the autores.php?id result and if it's on livros give livros.php?id_li.. and so on..?



Sorry if my explanation is too confuse, maybe i'm not building the sites has i should.

The site i need to do is similar to www.oncoguia.com.br but this one don't have search engine, and the one i'm about to do needs it.

Thanks in advance
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.