Re: Warning: mysql_fetch_assoc()
1. Use the mysqli API. The mysql API is deprecated and will go away.
2. Always handle the possibility of error:
> mysql_connect('localhost', 'xxxxxxx','xxxxxxxxx');
$conn = mysqli_connect(...) or exit( mysqli_connect_error() );
3. The query function does not return records. Fopr a Select query it returns a resource which can be used to fetch records, or FALSE if it fails:
$res = mysqli_query($conn, $sql) or exit( mysqli_error($conn) );
Read about these funcs in the PHP manual.
Edited 1 time(s). Last edit at 11/01/2015 03:09PM by Peter Brawley.
Subject
Written By
Posted
Re: Warning: mysql_fetch_assoc()
November 01, 2015 01:59AM
November 03, 2015 02:45PM
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.