alin19 Posted January 17, 2008 Share Posted January 17, 2008 <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 Quote Link to comment https://forums.phpfreaks.com/topic/86460-php-cli-connecting-to-mysql/ Share on other sites More sharing options...
alin19 Posted January 17, 2008 Author Share Posted January 17, 2008 <?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; Quote Link to comment https://forums.phpfreaks.com/topic/86460-php-cli-connecting-to-mysql/#findComment-441827 Share on other sites More sharing options...
revraz Posted January 17, 2008 Share Posted January 17, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/86460-php-cli-connecting-to-mysql/#findComment-441831 Share on other sites More sharing options...
alin19 Posted January 17, 2008 Author Share Posted January 17, 2008 solve that before, that is what was hapening, now the script execute, i connect to mysql but the query isn't executed Quote Link to comment https://forums.phpfreaks.com/topic/86460-php-cli-connecting-to-mysql/#findComment-441933 Share on other sites More sharing options...
revraz Posted January 17, 2008 Share Posted January 17, 2008 if ($mysql_query($query)) or die (mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/86460-php-cli-connecting-to-mysql/#findComment-441940 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.