Page 1 of 1

PHP Gurus...

PostPosted: Fri Jul 14, 2017 12:25 pm
by David de Argentina
Hi overthere,

I'm trying to automatize a PHP program for diferent users/servers/databases.

I had uploaded a config.inc.php files with dbname, dbserver, dbuser & dbpass values.

In fact, all appairs good.

Now, i'm trying to insert someting like this into the php's program:

Syntax: [ Download ] [ Hide ]
Using PHP Syntax Highlighting
<?php
header("Access-Control-Allow-Origin: *");
$config = include_once('config.inc.php');
echo "<br/><br/>";


$link = mysql_connect($config['dbserver'], $config['dbuser'], $config['dbpass']) or die('Could not connect: ' . mysql_error());
mysql_select_db($config['dbname']) or die('Could not select database');
mysql_set_charset('utf8');

$query = 'select * from Clients order by name asc' ;
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
mysql_set_charset('utf8');

while ($fila = mysql_fetch_array($result, MYSQL_BOTH)) {
       echo $fila["id"] . ' - ' . $fila["nombre"];
      }


mysql_free_result($result);
mysql_close($link);
?>
Parsed in 0.064 seconds, using GeSHi 1.0.8.10


But something is wrong, i receive this message:
"Could not connect: No such file or directory"

Any ideas?

Thanks in advance,
David de Argentina

Re: PHP Gurus...

PostPosted: Fri Jul 14, 2017 3:37 pm
by David de Argentina
Solved using another way...

Thanks again...

David de Argentina