Home mysql query isn't returning data
Reply: 0

mysql query isn't returning data

Adam Zeigler
1#
Adam Zeigler Published in 2017-12-07 15:13:08Z

This question already has an answer here:

  • PHP: “Notice: Undefined variable”, “Notice: Undefined index”, and “Notice: Undefined offset” 23 answers
  • mysql_fetch_array()/mysql_fetch_assoc()/mysql_fetch_row() expects parameter 1 to be resource 33 answers

why can't I get the pageTitle I can get the pageId this is the line it fails on:

$sqlARTICLEQuery = "SELECT * from pages, articles where pages.pageId = 
articles.pageId and pageTitle =".$_GET['pageTitle']." order by pages.pageId, 
articles.articleId";

$articlequeryResult = mysqli_query($conn,$sqlARTICLEQuery);
while ($articlequeryRow = mysqli_fetch_object($articlequeryResult))
{
$articles ="<a href = article.php?articleId=".$articlequeryRow->articleId." 
data-role='button'><button id ='wrapper'>".$articlequeryRow->articleTitle."
</button></a><br/><br/>";
echo $articles;
}

I get an error that says

Notice: Undefined index: pageTitle

Warning: mysqli_fetch_object() expects parameter 1 to be mysqli_result, boolean given in

not sure why I am getting this especially if I change the variable $_GET['pageTitle'] to $_GET['pageId'] it works.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.387317 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO