MySQL Forums
Forum List  »  PHP

Re: Mysqli vs mysql
Posted by: Barry Galbraith
Date: November 01, 2017 02:54PM

Your code
/* Display results */ 
echo "<table border='1'><thead><tr>"; 
for($i = 0;$i < mysql_num_fields($result);$i++) 

{ 
echo "<th>".mysql_field_name ($result,$i) . 
"</th>"; 
}

You have 2 mysql() functions there instead of mysqli. As you made the connection with mysqli() you have to use mysqli() functions on that connection.
Look up the php refman for mysqli() syntax http://php.net/manual/en/refs.database.vendors.php


As PB says, any reference that shows to use mysql() should be archived. You should use a reference for mysqli() (or PDO).

Good luck,
Barry.

Options: ReplyQuote


Subject
Written By
Posted
October 04, 2017 02:16PM
October 04, 2017 03:07PM
October 04, 2017 07:04PM
Re: Mysqli vs mysql
November 01, 2017 02:54PM
October 31, 2017 03:01AM


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.