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 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; 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 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 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()); 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
Archived
This topic is now archived and is closed to further replies.