Jump to content

Basic question: Search Help


bugzy

Recommended Posts

Beginner's question guys.

 

I'm about to do a search function now.

 

I was thinking  like this..

 

 

From an html form with a method get..

 

Let's say: textbox_search = 200

 

URL: www.mywebsite.com.php?id=200

 

<?php

if(isset($_GET['search']))
{

$query = "Select * from student where id = '{$_GET['id']}'";

$result = mysql_query = ($query,$connection) or die (mysql_error());

}
else
{
$query = "Select * from student";

$result = mysql_query = ($query,$connection) or die (mysql_error());

}




?>

 

 

 

Is this fine? or am I going to have an issue latter?

 

Confused if I'm going to use post or get

Link to comment
https://forums.phpfreaks.com/topic/266356-basic-question-search-help/
Share on other sites

 

Pikachu2000.. Not really mean what you're trying to imply there but I do have mysql_real_escape_string function that I'm using on every sql statement that I'm passing on the server.

 

I just didn't put it on the code above because it isn't part of my question and I just type the code directly here so you guys would  understand it better.

 

 

So it's better to just create a search landing page rather than directing the user to where he search it?

 

Because what I want is to search and show results on the same page..

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.