Site Search Problems: Need Help!

General discussions related to php

Moderators: macek, egami, gesf

Post Reply
User avatar
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back

Post by swirlee » Sat Jul 19, 2003 10:09 am

stevebob, the first step in solving a MySQL problem is seeing if your query actually works. So instead of running your query straight away, echo it and see what it looks like. If it still looks alright, copy and paste it to the MySQL console (mysql.exe, try "mysql --help" for more info) and see if it works. If it works, then you know that it's a PHP problem, not a MySQL problem.

My guess is that there's something wrong with your regular expressions, but that's not my department. Give the above a go and let us know what happens.

And as a side note, you don't need to use backticks (`) to surround column names unless your column names happen to be reserved words or have unusual markup, neither of which seems to be the case.

User avatar
Posts: 1256
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol

Re: Site Search Problems: Need Help!

Post by WiZARD » Mon Jul 21, 2003 2:08 am


Code: Select all

$conn = mysql_connect("localhost",$username,$password) or die( "Unable to connect: " . $my_sqlerror());
$dbase=mysql_select_db($database) or die( "Unable to select database: " . $my_sqlerror());

$query= "SELECT * FROM `search`";

and second:

Code: Select all

//`words`: where formatted text goes
$query2 = "UPDATE `search` WHERE `id` = " . $id . " SET `words` = " . $text;

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests