By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,651 Members | 1,908 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,651 IT Pros & Developers. It's quick & easy.

can php mysql work in Windows but not Solaris?

P: n/a
can mysql work in Windows but not Solaris?
Is there any reason you can see why the fulltext php/mysql code below
works OK on my win2k php4.3.6. mysql 4.1.3 pc but does *not* work when
put on a Solaris Server with php5 mysql 4.1.6 ?

That is what happens...I'm suspicious of the accent characters in the
code but I am not sure if there's any truth to my suspicion and how I'd
even test or fix it(?) Here's the snip I think causes the problem:
....
else {
if ( $Type_Submit == 'radio_and') {
$radio_keyword = preg_replace('/\s+|^/', ' +', $keyword);
}
elseif ( $Type_Submit == 'radio_phrase'){
$radio_keyword = '"'.$keyword.'"';
}
$query =
"SELECT page.* FROM `page` LEFT JOIN `keywords` USING
(`page_id`) WHERE MATCH (`keywords`.`keyword_txt`)
AGAINST ('$radio_keyword' IN BOOLEAN MODE)
UNION
SELECT page.* FROM `page` WHERE MATCH (`title`, `descrip`)
AGAINST ('$radio_keyword' IN BOOLEAN MODE)
UNION
SELECT page.* FROM `page` LEFT JOIN `url_Pages` USING (`page_id`)
WHERE MATCH (`url_Pages`.`page_url`)
AGAINST ('$radio_keyword' IN BOOLEAN MODE)";
$result = mysql_query($query);
}

--
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"Hal Halloway" <Ha******@nospam.net> wrote in message
news:jOmGd.570$Hg6.260@trnddc09...
can mysql work in Windows but not Solaris?
Is there any reason you can see why the fulltext php/mysql code below
works OK on my win2k php4.3.6. mysql 4.1.3 pc but does *not* work when
put on a Solaris Server with php5 mysql 4.1.6 ?

That is what happens...I'm suspicious of the accent characters in the
code but I am not sure if there's any truth to my suspicion and how I'd
even test or fix it(?)
By writing your code in a manner that detects errors and deals with them
accordingly

-snip- $result = mysql_query($query);
}

$result = mysql_query($query , $conn);
if(! $result || mysql_error($conn))
{
echo "Unable to process query [$query] : " . mysql_error($conn);
}
Jul 17 '05 #2

P: n/a

Hal Halloway wrote:
can mysql work in Windows but not Solaris?
Is there any reason you can see why the fulltext php/mysql code below
works OK on my win2k php4.3.6. mysql 4.1.3 pc but does *not* work when put on a Solaris Server with php5 mysql 4.1.6 ?

That is what happens...I'm suspicious of the accent characters in the
code but I am not sure if there's any truth to my suspicion and how I'd even test or fix it(?) Here's the snip I think causes the problem:


You posted the same query on www.tek-tips.com ...

Here's my suggestions I posted there...

Where are your variables being set? If they are coming from a form or
the URL they this could be a problem with register_globals being set to
"on" on the Windows 2K pc and being set set to "off" on the Solaris
server.

If your variables are coming from a POSTED form use the superglobal
$_POST to retrieve the values. For instance assuming that your variable
$radio_keyword comes from a form, use $_POST['radio_keyword'] to get
the value. The same holds true if the variable comes from the URL,
except you would use the superglobal $_GET.

See http://www.php.net/ and read up on variable from outside of PHP.
Ken

Jul 17 '05 #3

P: n/a
Hal Halloway wrote:
can mysql work in Windows but not Solaris?
Is there any reason you can see why the fulltext php/mysql code below
works OK on my win2k php4.3.6. mysql 4.1.3 pc but does *not* work when
put on a Solaris Server with php5 mysql 4.1.6 ?

That is what happens...I'm suspicious of the accent characters in the
code but I am not sure if there's any truth to my suspicion and how I'd
even test or fix it(?) Here's the snip I think causes the problem:
...
else {
if ( $Type_Submit == 'radio_and') {
$radio_keyword = preg_replace('/\s+|^/', ' +', $keyword);
}
elseif ( $Type_Submit == 'radio_phrase'){
$radio_keyword = '"'.$keyword.'"';
}
$query =
"SELECT page.* FROM `page` LEFT JOIN `keywords` USING
(`page_id`) WHERE MATCH (`keywords`.`keyword_txt`)
AGAINST ('$radio_keyword' IN BOOLEAN MODE)
UNION
SELECT page.* FROM `page` WHERE MATCH (`title`, `descrip`)
AGAINST ('$radio_keyword' IN BOOLEAN MODE)
UNION
SELECT page.* FROM `page` LEFT JOIN `url_Pages` USING (`page_id`)
WHERE MATCH (`url_Pages`.`page_url`)
AGAINST ('$radio_keyword' IN BOOLEAN MODE)";
$result = mysql_query($query);
}


In addition to the things already recommended, while in the development
stage, I like to use a flag to optionally print out my queries to see
what they look like.

$debug = true;
..
..
if ($debug)
{
print "<pre>$query</re>";
}
$result = mysql_query($query);

One thing I noticed is you are wrapping the $keyword in double quotes
when you put it into $radio_keyword, then you wrap that in single quotes
when you build $query. So the SQL looks like

AGAINST ('"my_keyword"' IN BOOLEAN MODE)

I'm not sure how MySQL handles this. I.e., are the inner double quotes
part of the keyword. Why this would differ on different paltforms is
beyond me.

NM

--
convert uppercase WORDS to single keystrokes to reply
Jul 17 '05 #4

P: n/a


Thanks for the posts. I use all the advice.
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.