Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.