Search problem with phpfreaks

  badgermansix 10:58 25 Sep 06
Locked

Any advice please? I am attempting to use the search engine from

click here

which I have been told is very good?


I have followed the instructions exactly, added it to my very basic web page.
but I keep getting the following error:-
PHP Fatal error: Call to undefined function
" mysql_connect() in index.php on line 56 "

the lines are:-

?php
line 56 $cnx = mysql_connect 'localhost', 'phpfreaks', 'phpfreaks') or die ("Could not connect");
line 57 mysql_select_db('phpfreaks_search', $cnx) or die (mysql_error());
function searchForm()
{
// Re-usable form etc etc

Am I right in thinking that in line 56 "local host" is my web page, 'phpfreaks'(1) is the
username 'phpfreaks'(2) is the password.
Line 57 mysql_select_db('phpfreaks_search', $cnx) is looking for the database 'phpfreaks_search'?

I have double checked the script many times but cannot see why it will not pick up the
database which is fine.

I hope I have put enough info here to help?

tia

  beynac 13:14 25 Sep 06

I think that you've missed a bracket in line 56:

line 56 $cnx = mysql_connect ('localhost' etc....

  badgermansix 13:23 25 Sep 06

beynac, I'm sorry, the bracket is there, it was me cutting and pasting from notepad where I had written the above. below is the cut and paste from the original script.

$cnx = mysql_connect('localhost', 'phpfreaks', 'phpfreaks') or die ("Could not connect");
mysql_select_db('phpfreaks_search', $cnx) or die (mysql_error());

  beynac 17:58 25 Sep 06

In that case, I'm stumped. Your version looks exactly the same as mine (except for the fact that I used double-quotes - which shouldn't matter).

Are you sure that the database is OK?

  harristweed 19:55 25 Sep 06

$cnx = mysql_connect ("localhost", "phpfreaks", "phpfreaks");
if(mysql_select_db("phpfreaks_search", $cnx));

  ade.h 20:09 25 Sep 06

I can't give any input into this issue, but I was just wondering what you thought of the PHP Freaks search code. Is it reasonably easy to use?

  badgermansix 06:46 26 Sep 06

beynac,
Well, I loaded the phpFreaks db as instructed, and it looks fine?

harristweed
I did as you advised above, but this and got the same result, what I did find is that I if Iomit these two lines altogether, I do get the search options (normal and bolean) on my webpage, if I search for something, I get "Results" nothing in it of course because I am not connected, but at least I know things can only get better.

ade.h
All I can say is that the script and the database look o.k., it loaded perfectly and I
think it is me that is causing the problem that I have, not the script

I am away for this week,but I will respond asap if I can get to a PC.

tia

  harristweed 12:26 26 Sep 06

“PHP Fatal error: Call to undefined function” can only mean that the mysql library is not loaded in the php.ini file. This means that you must be using php5 as it is loaded by default in php4.


Look at the installation instructions, Make sure that the mysql stuff (I’ve not got php5 on this machine so can’t look for you) is loaded by the php.ini file.

  ade.h 14:43 26 Sep 06

Thanks for the reply, badgermansix. I might give it a go.

  badgermansix 16:35 28 Sep 06

harristweed, Thank you for your input, and yes, I have had a look and I have php v.5.0.5. installed.
php.ini is installed within windows.

But I do not know what I am looking for in that?

ade.h, good luck with this, and Please let us know how you have got on.

  ade.h 16:37 28 Sep 06

I will, thanks. It'll be a while before I get the time and energy to try it, though.

This thread is now locked and can not be replied to.

Surface Pro (2017) vs Surface Pro 4

20 groundbreaking 3D animation techniques

How to mine Bitcoin on Mac