Koozali.org: home of the SME Server

MySQL_connect with PHP

Offline alext

  • ****
  • 91
  • +0/-0
MySQL_connect with PHP
« on: January 17, 2005, 06:12:25 PM »
Hello,

I am a newbie to mysql and php and I'm having a little problem connecting to MYSQL on my SME 6.0 server.
I have installed the 3 line fix mentioned in the release notes.

I have written a simple PHP script but the link always comes back as a blank, (indicating a failure?).
The script is as follows:

<?php
$link = mysql_connect('localhost', 'root', '')
?>
<HTML>
<HEAD>
<TITLE></TITLE>
<META name="robots" content="nofollow,noindex">
<META name="keywords" content="">
</HEAD>
<BODY BGCOLOR=FFFFFF TEXT=000000 LINK=0000FF VLINK=800080>
MARKER<br>
Link = <?= $link ?><br>
</BODY>
</HTML>


Any help would be appreciated.
Thanks
Alex
...

ergozd

MySQL_connect with PHP
« Reply #1 on: January 18, 2005, 11:03:04 AM »
Code: [Select]
$link = mysql_connect('localhost', 'root', '')

$link = mysql_connect('localhost', 'USERNAME', 'PASSWORD')

MySQL user root has a LOOOOONG password, you'll find it in /root/my.cnf

Try with that...

Best rgds, Ergin

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
MySQL_connect with PHP
« Reply #2 on: January 18, 2005, 10:56:20 PM »
Quote from: "ergozd"
Code: [Select]
$link = mysql_connect('localhost', 'root', '')

$link = mysql_connect('localhost', 'USERNAME', 'PASSWORD')

MySQL user root has a LOOOOONG password, you'll find it in /root/my.cnf

Try with that...


No. Create a new mysql user, just for this script, with access only to the tables required for this script. Set a password for that user, and use that in this script.