when i search something in the database it doesn't show me what is in the databese how to connect into it or it doesnt show what is in it????

iamthwee commented: Poor question, not enough information +0

you need to have access to the database outside the script

check if you have access to phpMyAdmin or a direct console access

and if you have no idea if you have access to one of those, check with your network admin

i have read it and i have understand my mistakes,

so any answer or any ideas from you

so any answer or any ideas from you

I would suggest you use "GOOGLE" below is a link which is searched by looking for "PHP and MYSQL", this will go over basic db connection, unless you are using PDO, then google DB connection using PDO, or even use the search function on this forum.

http://www.w3schools.com/php/php_mysql_intro.asp

im traying to make good work and you are saying me how to make a question so i have to say you how to response to a question.

im asking just for help if i know how to do that i wasnt here spending my life with you.

im asking just for help if i know how to do that i wasnt here spending my life with you.

Please put the code you have used to try and connect to the database, and your SQL string.

Then perhaps people can help. DB conection is very basic PHP and MySQL. Help us to help you.

POST YOUR CODE

thnx for that i have it in my bookmark that page,the problem is when i search a word in db from the php it must display that because it is in the db but it shows this:Your search for andi returned no results.it must show anothers data

Post your table structure.
Post your query.

POST YOUR CODE

NO ONE CAN READ MINDS

 this is the index page:
 if (isset ($_POST['keywords'])){
$keywords =mysql_real_escape_string(htmlspecialchars(trim($_POST['keywords'])));
$keywords =$_POST['keywords'];
$errors = array ();

if (empty ($keywords)){
$errors[] = ('Please enter a serch terms');
}else if (strlen($keywords)<3){
$errors[] = ('Your search terms must be three or more characters');
}else if (search_results ($keywords) == false){
$errors []= ('Your search for '.$keywords.' returned no results');
}
if(empty($errors)) {
print_r(search_results ($keywords));
}else {
foreach ($errors as $error){

i have a funck.inc.php page it is connect with this if you wont its code i can send you

f you wont its code i can send you

Yes

the problem is when i search a word in db from the php it must display that because it is in the db but it shows this:Your search for andi returned no results.

I dont see any SQL query to the database!! If you want to query a database you MUST have a query and connection.

"SELECT * FROM [TABLE_NAME] WHERE [TABLE_COLUMN] = '$keywords'"
Member Avatar for iamthwee

To the OP you need to first learn basic 'netiquette.'

See my link in my original post.

  1. You have no idea how to correctly word your question so people can help you.
  2. You make vague statements, ' I can't search my database' with no background.
  3. You've already started a thread which is pretty much the same problem you're having here. Keep all the same questions in the SAME thread.
  4. Unfortunately, I and many others have lost the patience to help you as you are blatantly rude. Comments such as:

im asking just for help if i know how to do that i wasnt here spending my life with you.

Do you no favours. I for one, will no longer be replying to any of your questions.

commented: And you sir, well stated :) +4

here it is

<?php include('db.inc.php');


function search_results ($keywords){
$returned_results = array ();

$where = "";

$keywords= preg_split ('/[\s]+/',$keywords);
$total_keywords = count($keywords);

foreach ($keywords as $key=> $keyword){
$where .= "'keywords' LIKE '%$keyword%'";
if($key !=($total_keywords - 1)) {
$where .= " AND ";
}
}
$results ="SELECT 'title', LEFT('description',70) as 'description' , 'url' FROM  'articles' WHERE $where";
$results_num = ($results = mysql_query ($results)) ? mysql_num_rows($results): 0 ;

if ($results_num == 0){
return false;
}else{

while ($results_row = mysql_fetch_assoc($reults)){
$returned_results [] = array (
                       'title' => $results_row ['title'],
                       'description' => $results_row ['description'],
                       'url' => $results_row ['url']


);

}
return $returned_results;

}
}
 ?>

here you can connect to the db and can select what is in it

hey plz i need help i told you if i know this thing i wouldn't be here if i would be rich i should lerning this thing in a college is so hard to help me ??

hey plz i need help i told you if i know this thing i wouldn't be here if i would be rich i should lerning this thing in a college is so hard to help me ??

People have jobs!!!! I wipe my hands

@Andyy121

You need to follow the syntax, for a beginer string concatnation is very difficult. Better to use the follow syntax.

// Connecting a database host using username & password
$con = mysql_connect("host", "username", "password");
// Selecting the database
$db = mysql_select_db("database", $con);

Now you have to query the db for results.

// Quering db
$results = mysql_query("SELECT * FROM user");
the above statement will select all the records from user table.

$results = mysql_query("SELECT * FROM user WHERE id=1");
//the above statement will only display the first row.
//(note:- where id is the unique number. )

If you have 5 rows with id = 1 it will display the 5 records.

If you have any questions feel free to write me.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.