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

 

 

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.