Printer Friendly Version
Email this thread to a friend
|
Featured Web Site Template |
|
Reflects user activity within the last 5 minutes
|
|
| Member |
Message |
cajuns
Joined: Apr 10, 2006
# Posts: 104
|
Posted: 01/26/2007 06:52 am
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" ;
include("./dbax.php" ;
include("./common.php" ;
?>
<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
|
Posted: 01/26/2007 06:54 am
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
|
Posted: 01/26/2007 12:33 pm
Put your code in CODE tag to look like code
I guess, you are facing 'Register Globals off' problem. Read this thread.
|
 |
cajuns
Joined: Apr 10, 2006
# Posts: 104
|
Posted: 01/26/2007 01:32 pm
Thanks for the help Dinkar, I really appreciate it, it's driving me nuts!
|
 |
cajuns
Joined: Apr 10, 2006
# Posts: 104
|
Posted: 01/26/2007 02:26 pm
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
|
Posted: 01/26/2007 02:54 pm
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
|
Posted: 01/30/2007 12:51 am
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:
- You have not yet logged in, or registered properly as a member
- You are a member, but no longer have posting rights.
- 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
|
|