Jump to content

php cli connecting to mysql


alin19

Recommended Posts

<?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; :(

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.