User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 426,629 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,617 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser: Programming Forums

mysql search and display data help....

Join Date: Jan 2007
Posts: 1
Reputation: homienick is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
homienick homienick is offline Offline
Newbie Poster

Question Re: mysql search and display data help....

  #5  
Oct 24th, 2007
I'm trying to do just this, but when a persons profile loads, it grabs their user_id as the page is loading, then searches the database for that user_id, and displays the rows it found that contained that user_id.

basically the same thing here, but without the search form.

would i need to change this line, or delete it?:

 $search = "%" . $_POST["search"] . "%";
in the previously posted code:
<?php
  $search = "%" . $_POST["search"] . "%";

  mysql_connect ("localhost", "myuser", "mypassword");
  mysql_select_db ("mydatabase");

  $query = "SELECT mycolumn FROM mytable WHERE mycolumn LIKE '$search'";
  $result = mysql_query ($query);
  if ($result) {
    while ($row = mysql_fetch_array ($result)) {
      echo $row[0] . "<br>";
    }
  }
?>
Reply With Quote  
All times are GMT -4. The time now is 12:33 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC