MySQL Forums
Forum List  »  PHP

Re: Updating mysql from php
Posted by: Peter Brawley
Date: February 23, 2019 09:30AM

You're using an obsolete API for mysql, mysql. Don't. It has already gone way in some PHP versions. Use mysqli.

> foreach ($dbo->query($quer2) as $noticia2) {

Two problems with this, First, read the manual page again for query(); it returns a result object, not direct results. Second, every mysql call that can throw an err needs error handling. So the above would need to become something like ...

$res = $dbo->query($quer2);
if( !$res ) exit( $dbo->error );
$a = array();
while( $a=$res->fetch_array($res) ) {}
if( $dbo->error ) exit( $dbo->error );
foreach( ...

Edited 1 time(s). Last edit at 03/14/2019 09:41AM by Peter Brawley.

Options: ReplyQuote

Written By
February 22, 2019 03:55PM
Re: Updating mysql from php
February 23, 2019 09:30AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.