Hello I am very new at php, and needed some help.
I get an error of:
"Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /usr/home/www.xxx.com/xxx/xxx/online.php on line 176"
The code is:
$content.= $s;
}
}
function showAll(){
global $PATHTO_IMAGES, $DB_ONLINEPUB, $content;
$mysqlDataAllPub = mysql_query( "SELECT * FROM $DB_ONLINEPUB WHERE `publish` = '1' ORDER BY `name` ASC");
$dataLengthAllPub = mysql_num_rows($mysqlDataAllPub); //echo "HELLO DATALENGTH=" .$dataLengthAllPub;
$count = 0;
$s='';
for ($i=0; $i< $dataLengthAllPub; $i++ ) {
$online_pubID = mysql_result( $mysqlDataAllPub , $i, pubID );
$online_name = mysql_result( $mysqlDataAllPub , $i, name );
$online_orderID = mysql_result( $mysqlDataAllPub , $i, orderID );
$s.= '<li >
<div id="showallmod">
<div class="con">'
.showAllIssues($online_pubID).
'</div>
</div>
</li>';
}
$content= $s;
}
it looks like my query is not being populated properly. I checked my query format and got:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE publish = '1' ORDER BY name ASC' at line 1
QUERY: SELECT * FROM WHERE publish = '1' ORDER BY name ASC
My variable $DB_ONLINE is not being passed to my showall() function.
I believe that where the variable defined is:
if($pubID=="" && $issueID=="" || $task == "showall"){
$task="showall";
showAll();
}
if($task=="" && $issueID){
fetchIssueItem();
fetchPages($issueID);
}
if($task=="fetchissues"){
fetchPubItem();
}
if($task=="detail"){
fetchIssueItem();
fetchPages($issueID);
}
function displayListPubMenu(){
global $PATHTO_IMAGES, $DB_ONLINEPUB;
$mysqlDataListPub = mysql_query( "SELECT * FROM $DB_ONLINEPUB WHERE `publish` = '1' ORDER BY `name` ASC"); //SELECT * FROM $DB_WALLPAPER where id!=$id ORDER BY $order_by" );
$dataLengthPub = mysql_num_rows($mysqlDataListPub);
$s='';
for ($i=0; $i< $dataLengthPub; $i++ ) {
$online_pubID = mysql_result( $mysqlDataListPub, $i, pubID );
$online_name = mysql_result( $mysqlDataListPub, $i, name );
$online_orderID = mysql_result( $mysqlDataListPub, $i, orderID );
$s.= '<li><a href="online.php?task=fetchissues&pubID='.$online_pubID.'" target="_self">'. $online_name . '</a></li>';
}
return $s;
This is the point I am stuck at any help would be greatly appreciated!