Jump to content

Dire Help Needed!


GerryCarr

Recommended Posts

My web hosting with 1and1 was just updated and now my php is failing and I don't know why.

 

Heres the code:

 

if(empty($article)){
$head_query = mysql_query("SELECT * FROM article_cats WHERE id='$page'") or die(mysql_error());
}

if(empty($page)){
$head_query = mysql_query("SELECT title, `desc`, keywords FROM articles WHERE id='$article'") or die(mysql_error());
}


echo(mysql_num_rows ($head_query));


while($load_info =  mysql_fetch_array($head_query)){


$title = $load_info['title'];
$desc = $load_info['desc'];
$keywords = $load_info['keywords'];


}

 

The connection is working.

 

echo(mysql_num_rows ($head_query)); is throwing out 0 even tho if you ran the sql, in sql it returns 1

 

The issue seems revolves around mysql_fetch_array

 

Please help!

 

Link to comment
https://forums.phpfreaks.com/topic/242891-dire-help-needed/
Share on other sites

Where is $page being defined?

 

Well you could check to make sure your queries are populating properly by splitting out the actual statement like this:

 

if(empty($article)){

$head_query = "SELECT * FROM article_cats WHERE id='$page'";

echo $head_query;

//$head_query_run = mysql_query($head_query) or die(mysql_error());

}

 

This way you can at least make sure the query is being put together properly

Link to comment
https://forums.phpfreaks.com/topic/242891-dire-help-needed/#findComment-1247599
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.