Jump to content

Recommended Posts

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:

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

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

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




Link to comment
https://forums.phpfreaks.com/topic/13648-a-path-problem/
Share on other sites

All the errors your are getting is becuase of the first error message which is:
[i]Warning mysql_fetch_assoc():  supplied argument is not a valid MySQL result resource in /home/myusername/public_html/abc.php on line 8[/i]
You normally get this error message bacause you have an error within your query. To se what the problem is change this:
[code]$qryxyxTotal = mysql_query($query);[/code]
to the following:
[code]$qryxyxTotal = mysql_query($query) or die("Nnable to perform query: <code>" . $query . "</code><br />\n The error returned was: " . mysql_error());[/code]
Link to comment
https://forums.phpfreaks.com/topic/13648-a-path-problem/#findComment-52944
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/13648-a-path-problem/#findComment-52991
Share on other sites

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.
Link to comment
https://forums.phpfreaks.com/topic/13648-a-path-problem/#findComment-53002
Share on other sites

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?
Link to comment
https://forums.phpfreaks.com/topic/13648-a-path-problem/#findComment-53281
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.