Welcome Guest, Not a member yet? Register   Sign In
Mysql_query() function Error
#1

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
Reply
#2

(This post was last modified: 05-22-2019, 03:10 PM by noobie.)

(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!
Reply
#3

(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
Reply
#4

When using all MySQLi calls they are mysqli_method
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

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

Cool beans, thank you Heart
Reply
#6

(This post was last modified: 05-26-2019, 11:18 AM by MAILITY.)

(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
Reply
#7

(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
Reply




Theme © iAndrew 2016 - Forum software by © MyBB