Forum Moderators: coopster
I have problem in connecting MYSQL ver-5.0.18 with PHP ver-5.1.2 on APACHE ver 2.0.55 installed all three on window 2000 prof in P-IV machine. These are binary versions for win32. Also made changes in files like php.ini and httpd.conf as directed by the ref manuals.
c:\php is the php directory
php.ini-recommand file is renamed as php.ini and placed in the window path directory c:\winnt.
Enabled the entries in php.ini for extension=php_mysql.dll and
extension_dir=c:\php\ext where the dll modules reside.
c:\program files is the directory for apache group and mysql.
Enabled the entries in httpd.conf in apache side as
PHPIniDir "C:/php"
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
downloaded php_mysql.dll, mysqli.dll and libmysql.dll from [dev.mysql.com...] site as it was recommended in an FAQ. copied this php_mysql.dll in c:\php\ext and libmysql.dll in c:\php as well as in c:\winnt. set path with new environment variable phprc to c:\php even though it does the same thing as 'phpinidir c:/php'
test.php has the phpinfo() function.
while running this on browser as [localhost...] it shows the php.ini path as c:\winnt.
But mysql_connect() function displays this error message.
Fatal error: Call to undefined function mysql_connect()
Tested by restarting the machine everytime of doing such changes. It will be very helpful if anyone could tell me what more to be done for this.
expecting guidence in this eagerly.
There is a thread in our PHP Forum Library [webmasterworld.com] that describes Troubleshooting Steps for PHP/Apache on windows [webmasterworld.com]. It includes some MySQL troubleshooting steps as well.
Thank you for directing me to the trouble shooting steps for php/apache on windows. with this i just placed php.ini in apache2 directory instead of winnt system path and found no mysql_connect() error. but there are multiple new errors as stated below. I also set display_error = on in php.ini to see the errors on the screen.
1.when i use any function even like
echo "My name is {$_GET['name']} <br>";
it displays the error "PHP notice: undefined index-" followed by the variable name.
2. The INSERT command of mysql gives error as "PHP parse error: syntax error, unexpected T_STRING in " following the path of corresponding .php when running on browser. But the same command and syntax is working well in mysql prompt inserting the given values in rows. php itself is showing when using select query in it(ie select query is working in php but INSERT statement is not working).
3. when including any library file like opendb.php it gives error as "PHP Warning: include(opendb.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\test6.php on line 3. Searched these opendb.php in the system but not found.
Please let me know if anybody knows the solutions for these errors.
or
check if this $_GET exist:
if(isset(_GET['name'])) echo "My name is {$_GET['name']} <br>";
else echo "My name is not yet specified <br>";
Write here your SQL querry, but what I can already tell I think you are closing the quotes before end, like this:
$sql = "INSERT INTO "table" ...";//table is outside the quotes, what is a parse error
instead use single quotes:
$sql = "INSERT INTO 'table' ..."//this will work.
Also escape every variable with mysql_real_escape_string($var):
$sql = "SELECT * FROM `table` WHERE id='".mysql_real_escape_string($id)."'";
Hope this helps
Michal