mysql - Error in PHP code accessing the SQL -
this question has answer here:
the code mean't connect database. did work stopped working, i've tried reading error code shown below can't seem fix it. here unworking code:
<?php mysql_connect("127.0.0.1", "goaerox_lkdb1", "~censored~"); //your parameters here mysql_select_db("goaerox_lkdb1"); //you db name here $q = "select id, channel, email, paypal, network partners;"; $result = mysql_query($q); echo "<table>"; echo "<tr><td>id</td><td>channel</td><td>email</td><td>paypal</td><td>network </td><td>actions</td></tr>"; while ($row = mysql_fetch_array($result, mysql_num)) { echo "<tr>"; echo "<td>".$row[0]."</td>"; echo "<td>".$row[1]."</td>"; echo "<td>".$row[2]."</td>"; echo "<td>".$row[3]."</td>"; echo "<td>".$row[4]."</td>"; echo "</tr>"; } echo "</table>"; mysql_free_result($result); ?>
now have seen that, should have better understanding on meant do. current error getting:
warning: mysql_fetch_array() expects parameter 1 resource, boolean given in public_html/test.php on line 10 id channel email paypal network actions warning: mysql_free_result() expects parameter 1 resource, boolean given in public_html/test.php on line 21
if please me appreciated.
please note mysql_
functions deprecated. aside that, problem can explained via following sentence the documentation:
for select, show, describe, explain , other statements returning resultset, mysql_query() returns resource on success, or false on error.
what happening select statement not retrieving database results, getting false
return value, boolean value. subsequently, mysql_fetch_array()
function failing because first parameter passing not resource, expected, boolean value false
.
Comments
Post a Comment