Printer Friendly Version Print this thread
Email this thread to a friend eMail this thread to a friend
Related Forum Posts
Featured Web Site Template

Hundreds More at Free Site Templates.com!

Web Site Partners
Sponsored Links
Jet City Software
 
Whos Here ?
Reflects user activity within the last 5 minutes
Moderator(s): Prowler, jcokos
Member Message

cajuns
Joined: Apr 10, 2006
# Posts: 104

View the profile for cajuns Send cajuns a private message

Posted: 01/26/2007 06:52 am
Edit Message Delete Message Reply to this message

Hi all,

My server crashed a while back, and once they reinstalled everything, some of my functions aren't working. Everything was working fine before the crash. One is the print.php Could someone please try and help? I have asked the server, they say it's not on their end (strange it worked before!) I have also tried to figure it out by myself, and have asked someone else that knows some php. Mine is a recipe site, and when you try and print the recipe now, these are these errors:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/recipes/public_html/print.php on line 24

Ingredients

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/recipes/public_html/print.php on line 51

Directions

___________________________
This is the php print file:
PHP file print.php
==============================================================
<?php
session_start();
include("./config.php"wink;
include("./dbax.php"wink;
include("./common.php"wink;

?>

<HTML>

<HEAD>
<TITLE><?php printf($sitename); ?></TITLE>
<META name="description" content="">
<META name="keywords" content="">
</HEAD>

<BODY BGCOLOR="FFFFFF" TEXT="000000" LINK="0000FF" VLINK="0000FF">

<?php

$sql = "select d.title, d.recipe, d.hits, d.rating, d.userid, c.category from recipes d, categories c where d.recipeid = $recipeid and c.categoryid = d.categoryid";
$result = mysql_query($sql ,$db);

if ($myrow = mysql_fetch_array($result)) {
do {
$pagetitle = $myrow["title"];
$directions = $myrow["recipe"];
$hits = $myrow["hits"];
$rating = $myrow["rating"];
$userid = $myrow["userid"];
$category = $myrow["category"];
} while ($myrow = mysql_fetch_array($result));

}

?>


<p><FONT face=arial color=#000000 size=4><B><?php printf($pagetitle); ?></b></font></p>

<FONT face=arial color=#000000 size=3><B>Ingredients</B></FONT>
<p>

<ul>

<?php

$sql = "select * from ingredients where recipeid = $recipeid";
$result = mysql_query($sql ,$db);

if ($myrow = mysql_fetch_array($result)) {

do {

printf("<li><FONT face=arial color=#000000 size=2>%s</FONT></li>", $myrow["ingredient"]);

} while ($myrow = mysql_fetch_array($result));

}

?>

</ul>

<br>


<FONT face=arial color=#000000 size=3><B>Directions</B></FONT>
<p>
<FONT face=arial color=#000000 size=2><?php printf($directions); ?></FONT>
</p>
<br>

<CENTER>

<font size="2">Copyright <?php printf($sitename); ?> 2002 <a href="mailto:<?php printf($webmasteremail); ?>"><?php printf($webmasteremail); ?></a></font>

<br>

</CENTER>
</BODY>
</HTML>











cajuns
Joined: Apr 10, 2006
# Posts: 104

View the profile for cajuns Send cajuns a private message

Posted: 01/26/2007 06:54 am
Edit Message Delete Message Reply to this message

Ummmm...sorry, don't know why those smiles showed up in the post, and not sure how to get them out! I didn't put them there.



Dinkar
Moderator
Joined: Aug 12, 2001
# Posts: 4317

View the profile for Dinkar Send Dinkar a private message

Posted: 01/26/2007 12:33 pm
Edit Message Delete Message Reply to this message

Put your code in CODE tag to look like code smile

I guess, you are facing 'Register Globals off' problem. Read this thread.



cajuns
Joined: Apr 10, 2006
# Posts: 104

View the profile for cajuns Send cajuns a private message

Posted: 01/26/2007 01:32 pm
Edit Message Delete Message Reply to this message

Thanks for the help Dinkar, I really appreciate it, it's driving me nuts!



cajuns
Joined: Apr 10, 2006
# Posts: 104

View the profile for cajuns Send cajuns a private message

Posted: 01/26/2007 02:26 pm
Edit Message Delete Message Reply to this message

Hi again,

I tried turning the register globals on to see if that was what the problem was. It did take care of the print problem, and also took care of member login, and new member registration problems. But it created a few other problems. (I believe the new ones came from a mod that was installed that did not get reinstalled.)

So, I turned register globals back off, since I read to keep them on is not a good thing.

It looks to me like it is this line
if ($myrow = mysql_fetch_array($result)) {
that is not correct with the globals turned off.
I did read the php stuff, but I am not savvy enough to be able to quite understand what to change and to what.

Any help? I would appreciate it.



Dinkar
Moderator
Joined: Aug 12, 2001
# Posts: 4317

View the profile for Dinkar Send Dinkar a private message

Posted: 01/26/2007 02:54 pm
Edit Message Delete Message Reply to this message

echo $result

It doesn't contain the data that it should. So you need to write correct code to put the data in $result.




cajuns
Joined: Apr 10, 2006
# Posts: 104

View the profile for cajuns Send cajuns a private message

Posted: 01/30/2007 12:51 am
Edit Message Delete Message Reply to this message

hmmmm.....Okay, thanks for your help!


You are not permitted to post messages in this forum or topic, because of one or more of the following reasons:
  1. You have not yet logged in, or registered properly as a member
  2. You are a member, but no longer have posting rights.
  3. This is a private forum, for which you do not have permissions.

If you are a recent member, it's possible that you simply have not yet confirmed your account. Please check your email for a message entitled 'JimWorld Forums: Confirm Your Account' and follow the instructions contained within.

If you cannot find this message, click here to Re-Send it.

If you are still experiencing problem, please read the Login Assistance Article for some advice on what may be causing your login not to work properly.

Switch to Advanced Editor and ... Create a New Topic or Reply to this Thread

New posts Forum is locked
© 1995  ·  iWeb, Inc  ·  DBA JimWorld Productions