CodeIgniter Forums
Mysql_query() function Error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Mysql_query() function Error (/showthread.php?tid=73693)



Mysql_query() function Error - Mekaboo - 05-22-2019

Hello all!

Im getting this error and trying to fix it:

An uncaught Exception was encountered

Type: Error
Message: Call to undefined function mysql_query()
Filename: /home4/cultured/public_html/application/views/dashboard.php
Line Number: 332

Its from this line of code: 
$mysql=mysql_query("select * from messages order by msg_id desc");

Im connected to DB (include("application/config/database.php")); and upgraded within webhost from 5.4 to 7.0 php but still get this error. I feel that I suppose to add the table (citable) that I made within the database but not sure. How to correct this if possible?

Heart Heart ,
Mekaboo


RE: Mysql_query() function Error - noobie - 05-22-2019

(05-22-2019, 01:41 PM)Mekaboo Wrote: Hello all!

Im getting this error and trying to fix it:

An uncaught Exception was encountered

Type: Error
Message: Call to undefined function mysql_query()
Filename: /home4/cultured/public_html/application/views/dashboard.php
Line Number: 332

Its from this line of code: 
$mysql=mysql_query("select * from messages order by msg_id desc");

Im connected to DB (include("application/config/database.php")); and upgraded within webhost from 5.4 to 7.0 php but still get this error. I feel that I suppose to add the table (citable) that I made within the database but not sure. How to correct this if possible?

Heart Heart ,
Mekaboo

You are using the deprecated mysql_query function... (which is removed as of PHP 7.0)

Either you're using mysql_query manually in your script (which means your issue is not related to CI and you should read about MySQLi or PDO)

or you're using an ancient script which was set to use mysql, in that case:

Go to application => config => database.php and change from

PHP Code:
$db['default']['dbdriver'] = 'mysql'

to

PHP Code:
$db['default']['dbdriver'] = 'mysqli'

Not sure if your script can be trusted anymore in production even after this change!


RE: Mysql_query() function Error - Mekaboo - 05-22-2019

(05-22-2019, 03:04 PM)noobie Wrote:
(05-22-2019, 01:41 PM)Mekaboo Wrote: Hello all!

Im getting this error and trying to fix it:

An uncaught Exception was encountered

Type: Error
Message: Call to undefined function mysql_query()
Filename: /home4/cultured/public_html/application/views/dashboard.php
Line Number: 332

Its from this line of code: 
$mysql=mysql_query("select * from messages order by msg_id desc");

Im connected to DB (include("application/config/database.php")); and upgraded within webhost from 5.4 to 7.0 php but still get this error. I feel that I suppose to add the table (citable) that I made within the database but not sure. How to correct this if possible?

Heart Heart ,
Mekaboo

You are using the deprecated mysql_query function... (which is removed as of PHP 7.0)

Either you're using mysql_query manually in your script (which means your issue is not related to CI and you should read about MySQLi or PDO)

or you're using an ancient script which was set to use mysql, in that case:

Go to application => config => database.php and change from

PHP Code:
$db['default']['dbdriver'] = 'mysql'

to

PHP Code:
$db['default']['dbdriver'] = 'mysqli'

Not sure if your script can be trusted anymore in production even after this change!

That was changed in my database.php file. I may have to take your advice and cut the code out. Thank you so very much Heart


RE: Mysql_query() function Error - InsiteFX - 05-23-2019

When using all MySQLi calls they are mysqli_method


RE: Mysql_query() function Error - Mekaboo - 05-23-2019

(05-23-2019, 03:06 AM)InsiteFX Wrote: When using all MySQLi calls they are mysqli_method

Cool beans, thank you Heart


RE: Mysql_query() function Error - MAILITY - 05-24-2019

(05-22-2019, 04:52 PM)Mekaboo Wrote:
(05-22-2019, 03:04 PM)noobie Wrote:
(05-22-2019, 01:41 PM)Mekaboo Wrote: Hello all!

Im getting this error and trying to fix it:

An uncaught Exception was encountered

Type: Error
Message: Call to undefined function mysql_query()
Filename: /home4/cultured/public_html/application/views/dashboard.php
Line Number: 332

Its from this line of code: 
$mysql=mysql_query("select * from messages order by msg_id desc");

Im connected to DB (include("application/config/database.php")); and upgraded within webhost from 5.4 to 7.0 php but still get this error. I feel that I suppose to add the table (citable) that I made within the database but not sure. How to correct this if possible?

Heart Heart ,
Mekaboo

You are using the deprecated  <-->Audacity Find My iPhone Origin mysql_query function... (which is removed as of PHP 7.0)

Either you're using mysql_query manually in your script (which means your issue is not related to CI and you should read about MySQLi or PDO)

or you're using an ancient script which was set to use mysql, in that case:

Go to application => config => database.php and change from

PHP Code:
$db['default']['dbdriver'] = 'mysql'

to

PHP Code:
$db['default']['dbdriver'] = 'mysqli'

Not sure if your script can be trusted anymore in production even after this change!

That was changed in my database.php file. I may have to take your advice and cut the code out. Thank you so very much Heart
Im getting this error and trying to fix it:

An uncaught Exception was encountered



RE: Mysql_query() function Error - Mekaboo - 05-24-2019

(05-24-2019, 08:50 AM)MAILITY Wrote:
(05-22-2019, 04:52 PM)Mekaboo Wrote:
(05-22-2019, 03:04 PM)noobie Wrote:
(05-22-2019, 01:41 PM)Mekaboo Wrote: Hello all!

Im getting this error and trying to fix it:

An uncaught Exception was encountered

Type: Error
Message: Call to undefined function mysql_query()
Filename: /home4/cultured/public_html/application/views/dashboard.php
Line Number: 332

Its from this line of code: 
$mysql=mysql_query("select * from messages order by msg_id desc");

Im connected to DB (include("application/config/database.php")); and upgraded within webhost from 5.4 to 7.0 php but still get this error. I feel that I suppose to add the table (citable) that I made within the database but not sure. How to correct this if possible?

Heart Heart ,
Mekaboo

You are using the deprecated mysql_query function... (which is removed as of PHP 7.0)

Either you're using mysql_query manually in your script (which means your issue is not related to CI and you should read about MySQLi or PDO)

or you're using an ancient script which was set to use mysql, in that case:

Go to application => config => database.php and change from

PHP Code:
$db['default']['dbdriver'] = 'mysql'

to

PHP Code:
$db['default']['dbdriver'] = 'mysqli'

Not sure if your script can be trusted anymore in production even after this change!

That was changed in my database.php file. I may have to take your advice and cut the code out. Thank you so very much Heart
Im getting this error and trying to fix it:

An uncaught Exception was encountered
Got it caught, thank you Heart