The site works perfectly on camp but I keep getting this error message
Fatal error: Uncaught Error: Call to undefined function
mysql_connect() in /storage/ssd1/760/4443760/public_html/conn.php:6
Stack trace: #0 /storage/ssd1/760/4443760/public_html/index.php(2):
include() #1 {main} thrown in
/storage/ssd1/760/4443760/public_html/conn.php on line 6
mysql_* functions have been removed in PHP7
You probably have a php7 in XAMPP Please use PDO and... Feel the power of the light side:)
Link to nice wiki page about :)
This link try it
PDO try it
Thanks
mysql_* functions have been removed in PHP7!
PDO
Related
I am using php 7.4. I have a php page called auth1. It requires a username and Password, which in the
past took me into auth3. I started receiving a deprecated error when I was on php 5.4 so I upgraded to
7.4. Now I get the error messages below. Any ideas. Could it be my mysql not compatible
Warning: Use of undefined constant user - assumed 'user' (this will throw an Error in a future version of PHP) in /home/utm/public_html/auth3.php on line 5
Warning: Use of undefined constant password - assumed 'password' (this will throw an Error in a future version of PHP) in /home/utm/public_html/auth3.php on line 5
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /home/utm/public_html/auth3.php:19 Stack trace: #0 {main} thrown in /home/utm/public_html/auth3.php on line 19
welcome to stackoverflow
your first and second lines are not Uncaught error and don't break your php processes
but about your last line it tell you that mysql_connect doesn't exists
because mysql extension and all of mysql_* functions are deprecated as of PHP 5.5 and has been removed as of PHP 7 to up
as the itachi said, and you said an example (mysqli) you should use a new extension between 3 following ways:
MySQLI reference functions Check they here
MySQLI OOP extension Check they here
PDO Extension Check they here
Also you can see this references for install your needs:
PDO Installation
MySQLI Installation
and about your 1st and 2nd lines you could put your codes to let us check, know and solve your problem
I am making my forum!
I have sql database and everything that I need to publish to the web (domain etc.)
So after launching my forum to the web I am getting the following error when trying to open my forum:
Fatal error: Uncaught Error: Call to undefined function
mysql_connect() in /storage/ssd5/357/5453357/public_html/config.php:14
Stack trace: #0 /storage/ssd5/357/5453357/public_html/main.php(3):
include() #1 {main} thrown in
/storage/ssd5/357/5453357/public_html/config.php on line 14
I tried everything but nothing worked!
Maybe someone from here can answer my question...
How to fix this?
Try mysqli_connect() instead, ‘mysql’ is deprecated. This is the case for every mysql function, so make sure everything is updated to ‘mysqli’. Hope this helps
Can anyone help me out on this error. I am setup my existing website on my localdisk using xampp but i m getting this error.
Fatal error: Uncaught Error: Call to undefined function
get_currentuserinfo() in
C:\xampp\htdocs\wordpress\wp-content\plugins\google-analytics-for-wordpress\frontend\abstract-class-tracking.php:286
Stack trace: #0
C:\xampp\htdocs\wordpress\wp-content\plugins\google-analytics-for-wordpress\frontend\abstract-class-tracking.php(51):
Yoast_GA_Tracking->do_tracking() #1
C:\xampp\htdocs\wordpress\wp-content\plugins\google-analytics-for-wordpress\frontend\class-frontend.php(27):
Yoast_GA_Tracking->__construct() #2
C:\xampp\htdocs\wordpress\wp-content\plugins\google-analytics-for-wordpress\googleanalytics.php(52):
Yoast_GA_Frontend->__construct() #3
C:\xampp\htdocs\wordpress\wp-settings.php(305)
Probably an outdated plugin, Update your plugin or you can try wp_get_current_user() function instead.
Its not a good idea to change the plugin code, but you can check that function whether it fixes things up or not, better option is to update your plugin.
While executing this code in PHP:
$db_nosql = new PDO('cassandra:host=127.0.0.1;port=9160;cqlversion=3.0.0');
I got a error message:
Fatal error: Uncaught exception 'PDOException' with message
'CQLSTATE[HY000] [2] Cannot execute/prepare CQL2 statement since the
CQL has been set to CQL3(This might mean your client hasn't been
upgraded correctly to use the new CQL3 methods introduced in Cassandra
1.2+).'
in /home/web/site/Test/page.php:202 Stack trace: #0
/home/web/site/Test/page.php(202): PDO->exec('USE mailing') #1 {main}
thrown in /home/web/site/Test/page.php on line 202
I don't know what I am supposed to do in this situation. Does that means that the syntax is incorrect ?
Thank you.
Can try the library. It uses the native protocol and does not require other libraries.
In a PHP application that I wrote, I keep getting an error that says:
Fatal error: Uncaught exception 'ActiveRecord\DatabaseException' with message 'exception 'PDOException' with message 'could not find driver' in /home/diftx/public_html/dol/sparks/php-activerecord/0.0.1/vendor/php-activerecord/lib/Connection.php:239 Stack trace: #0 /home/diftx/public_html/dol/sparks/php-activerecord/0.0.1/vendor/php-activerecord/lib/Connection.php(239): PDO->__construct('mysql:host=loca...', 'diftx_skcin7', 'thePassword', Array) #1 /home/diftx/public_html/dol/sparks/php-activerecord/0.0.1/vendor/php-activerecord/lib/Connection.php(101): ActiveRecord\Connection->__construct(Object(stdClass)) #2 /home/diftx/public_html/dol/sparks/php-activerecord/0.0.1/vendor/php-activerecord/lib/ConnectionManager.php(33): ActiveRecord\Connection::instance('mysql://diftx_s...') #3 /home/diftx/public_html/dol/sparks/php-activerecord/0.0.1/vendor/php-activerecord/lib/Table.php(103): ActiveRecord\ConnectionManager::get_connection(NULL) #4 /home/diftx/public_html/dol/sparks/php-activerecord/0.0.1/vendor/php-activerecord/lib/Tabl in /home/diftx/public_html/dol/sparks/php-activerecord/0.0.1/vendor/php-activerecord/lib/Connection.php on line 241
Based on this message, I did some research about PDO and can't seem to figure out.
Here is a screenshot from my phpinfo() showing PDO information:
When I log into the server via PuTTY and type "php -m" a list of modules appear. In the list is both entries for PDO and pdo_sqlite.
I am somewhat new to server configuration and I simply cannot seem to figure out what I am doing wrong to set this up. Help!
Just like to answer this (I commented the solution). You do not have the required drivers for PDO to work with MySQL. You need to install them before you can use MySQL with PDO.