Jump to content


Photo

A Path problem...


  • Please log in to reply
4 replies to this topic

#1 russia5

russia5
  • Members
  • PipPipPip
  • Advanced Member
  • 94 posts

Posted 04 July 2006 - 03:25 PM

I am makeing a new membership area, so I need to take my index.php and move it to a folder. Let's call the new file, indexmember.php  index.php as well as indexmember.php has thumbnails delivered by MySQL embedded in them by includes.  There is a file that calls the thumbnails up included.  Lets call it abc.php  I changed the path to the config.php and abc.php to <php? http://www.mysite.com/config.php (or /abc.php) ?>  This seemed to work fine.  However I am getting an error:

Warning mysql_fetch_assoc():  supplied argument is not a valid MySQL result resource in /home/myusername/public_html/abc.php on line 8

Warning Divission by zero in /home/myusername/public_html/abc.php on line 8
Warning mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/myusername/public_html/abc.php on line 34

The code on abc.php is:

<?php

include('qry_xyx.php');

$query = 'SELECT count(sid) AS total FROM Profile_delivery WHERE 1=1 '.$whereClause;
$qryxyxTotal = mysql_query($query);

$girlsCount = mysql_fetch_assoc($qryxyxTotal);
$girlsCount = $girlsCount['total'];
$pagesCount = ceil($xyxCount/$xyxPerPage);
if ($pagesCount > 10) $pagesCount = 10;

$count = $rows = 0;


Where:

This is line 8: $girlsCount = mysql_fetch_assoc($qryxyxTotal);

This is line 10: $pagesCount = ceil($girlsCount/$xyxPerPage);

And the following code which is down the page a ways is line 34:

<?php if (mysql_num_rows($qryxyx)) { ?>

Does anyone have an idea on why the MySQL fetch and call code does not gets interrupted by the includes?

Thanks






#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 04 July 2006 - 04:47 PM

All the errors your are getting is becuase of the first error message which is:
Warning mysql_fetch_assoc():  supplied argument is not a valid MySQL result resource in /home/myusername/public_html/abc.php on line 8
You normally get this error message bacause you have an error within your query. To se what the problem is change this:
$qryxyxTotal = mysql_query($query);
to the following:
$qryxyxTotal = mysql_query($query) or die("Nnable to perform query: <code>" . $query . "</code><br />\n The error returned was: " . mysql_error());


#3 russia5

russia5
  • Members
  • PipPipPip
  • Advanced Member
  • 94 posts

Posted 04 July 2006 - 06:54 PM

Wow!  You da Man!  That worked very nicely!  Here is what I got.

Nnable to perform query:  SELECT count(sid)  AS total FROM mysqltable WHERE 1=1
The error returned was:  No Database Selected

Thankyou very much!

Can I ask you, what thumbrule are you using to say that all the problems come from the first error.  Of course, that is accurate here.  Is that all the time you get an error, it just kind of compounds to many different places.  Or is it the nature of the problem here.  I know the first two are simular, but the third error is different.



#4 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 04 July 2006 - 07:14 PM

Most of the time any errors you get are usually caused by the first error, so you fix the first error then if the errors dont clear you'll try to fix the next error and the one after that, untill all errors are gone. But when you fix the first error you usally fined that most if not all errors get fixed in the process.

Also you'll need to connect to the database in order for your script to work, as the code snipet I told you to change stops the script from runnning if there is an error with performing the sql query.

#5 russia5

russia5
  • Members
  • PipPipPip
  • Advanced Member
  • 94 posts

Posted 05 July 2006 - 12:06 PM

The error that your code snippet gave me, was that I was not connected to the database.  I don't quite understand why not.  The index.php which is the same page as the membership.php and outside the folders is connected and works.  When the membership.php page is outside the folders, it works.  It is when I place the membership.php within a folder, that I loose the connection.

I believe that config.php is changed right within the membership.php  I changed it to <? include (http://www.mysite.com/config.php) ?>  from <? include (config.php) ?> 

Both, membership.php and index.php calls for a file via includes.  abc.php from above.  abc.php calls for a MySQL query file.  I believe it is this MySQL query file that does not see the connection.  Any ideas?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users