Jump to content


Photo

question about search


  • Please log in to reply
1 reply to this topic

#1 Gruzin

Gruzin
  • Members
  • PipPipPip
  • Advanced Member
  • 448 posts
  • LocationGeorgia

Posted 14 August 2006 - 02:34 PM

hi again,
one more question: I want to make a simple search, here is the code but it doesn't work, thnks for your help.

<?php
$con = mysql_connect("localhost","3d","pass");
if(!$con){
  die('Error:'.mysql_error()); // if not connected
}
mysql_select_db("3d",$con);
$result = mysql_query("SELECT * FROM text WHERE text");
while($row = mysql_fetch_array($result))
  {
  if($row['text'] == $_POST['search']){
  echo "Think I've found something";
  echo "</br>";
  echo $row['text'];
  }
  else {
  echo "no mathes found";
  }
}
mysql_close($con);
?>

I don't need your script, I'll try to write it myself

#2 JadedLucidity

JadedLucidity
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 14 August 2006 - 03:47 PM

maybe this will help.

<?php
$con = mysql_connect('localhost','3d','pass')
  or die('Error:'.mysql_error()); // if not connected
}
mysql_select_db('3d',$con)
  or die ('Could not select database');
<-----------SELECT col_name FROM tbl_name WHERE col_name > 0;----------> where requires a condition

$result = mysql_query("SELECT * FROM text WHERE text");
while($row = mysql_fetch_array($result))
  {
  if($row['text'] == $_POST['search']){
  echo "Think I've found something";
  echo "</br>";
  echo $row['text'];
  }
  else {
  echo "no mathes found";
  }
}
mysql_close($con);
?>




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users