PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old February 19th, 2013, 03:29 AM
rhodesy82 rhodesy82 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 1 rhodesy82 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 m 32 sec
Reputation Power: 0
Mysql & other databases - Help with PHP & MySql

Please can someone help me with this php thing that im trying to get to work.

My web site is sort of like a small search engine for my local town, and i would like customers who vist the site to be able to search for things. However when they carry out a search within the web site. The results produce all the data from the table in the Database.

I only want results returned that contain the details of searches using keywords.

<?php
// connect to your MySQL database here
include_once "connect_to_mysql.php";
// Build the sql command string
$sqlCommand = 'SELECT * FROM `directory` LIMIT 0, 10 ';
// Execute the query here now
$query = mysql_query($sqlCommand) or die (mysql_error());

// Output the data here using a while loop, the loop will return all information
while ($row = mysql_fetch_array($query)) {
// Gather all $row values into local variables for easier usage in output
$Name = $row["Name"];
$Description = $row["Description"];
$Keywords = $row["Keywords"];
$Url = $row["Url"];
// echo the output to browser
echo
"<a href='$Url'><b>$Name</b></a>
<br>
$Description
<br>
<a href='$Url'>$Url</a>
<hr />";
}
// Free the result set if it is large
mysql_free_result($query);
// close mysql connection
mysql_close();
?>


Table fields in mysql are:

Name
Description
Keywords
URL

If anybody can have a look at my code and let me know what i need to change, that would be great.

My web address is: whatsinweston.co.uk if you wish to have a look at the site to see what im talking about.

many thanks

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Mysql & other databases - Help with PHP & MySql


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap