MySQL Forums
Forum List  »  PHP

Re: Converting from Postgres to MySQL - PHP question
Posted by: Barry Galbraith
Date: August 22, 2010 01:35AM

pg_result is now called pg_fetch_result().
mysqli_fetch_array() fetchs a whole row into an array object.
You then access each field either by index or by name

$con = mysqli_connect('host','user','password',database') or die("Failed to connect");
$sql = "SELECT field1, field2 from mytable";

$result = mysqli_query($con, $sql) or die(mysqli_error($con));
while $row = mysqli_fetch_array($result){

  $field1 = $row['field1'];
  $field2 = $row['field2'];
}

Good luck,
Barry.

Options: ReplyQuote


Subject
Written By
Posted
Re: Converting from Postgres to MySQL - PHP question
August 22, 2010 01:35AM


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.