Sorry, didnt see your post.

Sorry, didnt see your post.
Last edited by James.Easy; 04-11-2006 at 12:30 PM.
VB Programmer looking for work
is the rite code. i hope.Code:CREATE TABLE search( id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), name VARCHAR(30) NOT NULL, url VARCHAR(30) NOT NULL, about TEXT NOT NULL)';
.:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
.:.: Stand up for what is right, even if you stand alone:.:.
Error
There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem
ERROR: Unclosed quote @ 143
STR: '
SQL: CREATE TABLE search(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id),
name VARCHAR(30) NOT NULL,
url VARCHAR(30) NOT NULL,
about TEXT NOT NULL)'
SQL query:
CREATE TABLE search( id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), name VARCHAR(30) NOT NULL, url VARCHAR(30) NOT NULL, about TEXT NOT NULL)'
MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''' at line 6
VB Programmer looking for work
:s mysql aint my thing.
http://www.colin-roberts.net/search.gz
theres a blank mysql database with tables installed.
Last edited by Colin-Roberts; 04-11-2006 at 01:01 PM.
.:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
.:.: Stand up for what is right, even if you stand alone:.:.
It sttill doesnt work, ggrr.I really need this.I'm rubbish with mySQL as well.
VB Programmer looking for work
the mysql has to be fine now did you edit your mysql details into the files
.:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
.:.: Stand up for what is right, even if you stand alone:.:.
I fixed it, made my own querie.
CREATE TABLE `search` (
`id` int(11) NOT NULL auto_increment,
`url` varchar(30) NOT NULL default '',
`name` varchar(255) NOT NULL default '',
`about` varchar(40) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM;
Search.PHP has a error.
Last edited by James.Easy; 04-11-2006 at 01:20 PM.
VB Programmer looking for work
theres search.php code took from my working one..
make sure to add mysql details.
PHP Code:<?php
$dbhost='localhost';
$dbusername='';
$dbuserpass='';
$dbname = '';
mysql_connect ($dbhost, $dbusername, $dbuserpass);
mysql_select_db($dbname) or die('Cannot select database');
$rowsPerPage = 5;
$pageNum = 1;
if(isset($_GET['page']))
{
$pageNum = $_GET['page'];
}
if(isset($_GET['search']))
{
$search = $_GET['search'];
}
// counting the offset
$offset = ($pageNum - 1) * $rowsPerPage;
$keywords = explode(" ", $search);
$query = "SELECT id,name,about,url FROM search " .
"WHERE about LIKE '%".$keywords['0']."%'";
for ($i=1; $i<count($keywords); $i++) {
$query = $query." AND about LIKE '%".$keywords[$i]."%'";
}
$query = $query." ORDER BY id LIMIT $offset, $rowsPerPage";
$result2 = mysql_query($query) or die(mysql_error());
?>
<html>
<head>
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<title>Cj Search - Results</title>
<link type="text/css" rel="stylesheet" href=/v4/search/css.css">
</head>
<body>
<center>
<img style="margin: 0px;" width="690" height="150" title="" alt="" src="http://www.colin.connect-hosting.com/v4/colinrobertsyf1.PNG">
</br>
<form method="GET" action="search.php">
<b>Search:</b> <input type="text" name="search" size="20" />
<input type="submit" value="Search!" />
</form>
<table width="50%" style="border:1px solid #000000;">
</body>
</html>
<?php
$keywords = explode(" ", $search);
$query = "SELECT COUNT(id) AS numrows FROM search " .
"WHERE about LIKE '%".$keywords['0']."%'";
for ($i=1; $i<count($keywords); $i++) {
$query = $query." AND about LIKE '%".$keywords[$i]."%'";
}
$result = mysql_query($query) or die('Error, query failed');
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$numrows = $row['numrows'];
$maxPage = ceil($numrows/$rowsPerPage);
$self = $_SERVER['PHP_SELF'];
$nav = '';
for($page = 1; $page <= $maxPage; $page++)
{
if ($page == $pageNum)
{
$nav .= " $page ";
}
else
{
$nav .= " <a href=\"$self?page=$page&search=$search\">$page</a> ";
}
}
if ($pageNum > 1)
{
$page = $pageNum - 1;
$prev = " <a href=\"$self?page=$page&search=$search\">[Prev]</a> ";
$first = " <a href=\"$self?page=1&search=$search\">[First Page]</a> ";
}
else
{
$prev = ' ';
$first = ' ';
}
if ($pageNum < $maxPage)
{
$page = $pageNum + 1;
$next = " <a href=\"$self?page=$page&search=$search\">[Next]</a> ";
$last = " <a href=\"$self?page=$maxPage&search=$search\">[Last Page]</a> ";
}
else
{
$next = ' ';
$last = ' ';
}
while($row = mysql_fetch_array($result2))
{
echo "<tr>";
echo "<td style='border-bottom: 1px solid #000000;'>";
echo "<b><a href=\"".$row['url']."\">".$row['name']."</a></b>";
echo "<p>".$row['about']."</p>";
echo "<p><a href=\"".$row['url']."\">".$row['url']."</a></p>";
echo "</td>";
echo "</tr>";
}
echo "<tr>";
echo "<td>";
echo "<center>".$first . $prev . $nav . $next . $last."</center>";
echo "</td>";
echo "</tr>";
?>
</td>
</tr>
</table>
</br>
<span class="nav"><font size="1" face="Verdana"><span class="nav">| <a href="/v4/search/add.php" title="">Add Your Site</a> | <a href="/terms.htm">Terms</a> | <a href="/credits.htm">Credits</a> |</span></font>
</center>
.:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
.:.: Stand up for what is right, even if you stand alone:.:.
Want to hide these adverts? Register an account for free!