Jump to content

php cli connecting to mysql


alin19

Recommended Posts

<php?

 

if ($dbc = mysql_connect ('http://195.214.105.196', 'root', '  '))

{

echo "conectat";

mysql_close();

}

else

neconectat;

 

?>

 

PHP Fatal error:  Call to undefined function mysql_connect() in C:\Documents and

Settings\Administrator\Desktop\php\test.php on line 3

 

what is wrong here, i'm using php cli, and easyphp 1.8

Link to comment
https://forums.phpfreaks.com/topic/86460-php-cli-connecting-to-mysql/
Share on other sites

<?php

 

 

 

 

 

$x= file ('C:\Documents and Settings\Administrator\Desktop\php\sif4.txt');

 

 

 

$n = count ($x);

echo $n;

 

 

 

 

for ($i=1;$i<3;$i++)

{

$rand= $i;

echo trim ($x[$rand]);

 

 

$arr=explode(" ",$x[$rand]);

print_r($arr);

 

 

 

 

 

if ($dbc = mysql_connect ('localhost', 'root', ''))

{

echo "conectat";

}

else

echo "neconectat";

 

echo " ";

 

 

 

 

 

$query= "INSERT INTO `test` ( `1` , `tra` , `piata` , `simbol` , `bidvol` , `bestbid` , `bestask` , `bidask` , `volum` , `pret` , `nrtra` , `data` , `var` )

VALUES (

'', '$arr[$i]', '$arr[$i]', '$arr[$i]', '$arr[$i]', '$arr[$i]', '$arr[$i]', '$arr[$i]', '$arr[$i]', '$arr[$i]', '$arr[$i]', '$arr[$i]'

)";

 

 

if ($mysql_query($query))

{

echo 'good';

}

else

{

echo 'bad';

}

 

}

 

mysql_close();

 

?>

 

i'm geting conected bad; :(

Check your PHP.INI and make sure the mysql section isn't remarked out.

 

PHP Fatal error:  Call to undefined function mysql_connect() in C:\Documents and

Settings\Administrator\Desktop\php\test.php on line 3

 

what is wrong here, i'm using php cli, and easyphp 1.8

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.