Solution/alternative to obsolete eregi_replace

Asked

Viewed 155 times

0

I’m getting the following error:

Deprecated: Function eregi_replace() is deprecated in C:\wamp\www\ajax\paginator.inc.php on line 202  

This is a line from a script that pages php+mysql+ajax

Line 202:

$_pagi_sqlConta = eregi_replace("select[[:space:]](.*)[[:space:]]from", "SELECT COUNT(*) FROM", $_pagi_sql);  

A lot of the querys are obsolete, and I’m adapting from mysql to mysqli. However, the 'eregi_replace' I did not know until now, and after searching, I could not find a solution/alternative for it.

1 answer

2


Replace with preg_replace and take the test.

$_pagi_sqlConta = preg_replace("/select[[:space:]]'\(.*\)'[[:space:]]from/", "SELECT COUNT(*) FROM", $_pagi_sql);  
  • Warning: preg_replace(): Delimiter must not be alphanumeric or backslash in C: wamp www ajax Paginator.inc.php on line 202 .

  • 1

    I edited, try now.

  • It seems that the preg_replace error has been fixed. However, an error occurred below lines: Fatal error: Call to Undefined Function mysqli_result() in C: wamp www ajax Paginator.inc.php on line 208. Line 208: $_pagi_totalReg = mysql_result($_pagi_result2,0,0);//total records

  • That’s another mistake, I can’t tell you what it might be because I don’t see how it’s implemented.

  • All right, I understand. I will be marking the answer as correct, because it really solved the question, and what came after is consequence. I think it’s best to ask another question, don’t you? Oh... thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.