Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 07-05-2006, 07:12 AM My path changed...
Skilled Talker

Posts: 76
Trades: 0
My present membership page is outside the folders /public_html/membership.php

membership.php is identical to index.php, my home page. It has many .jpg's embedded into it delivered by my backend MySQL.

I took my membership.php and move it inside a folder. I adjusted membership.php includes to <?php include (http://www.mysite.com/config.php) ?> There were two more includes within membership.php , both going to php pages. From one of those php pages, there is another include going to MySQL query.

The problem, is that I am getting an error telling me that the database is not connected.

Is there any reason anyone can see why the database would not connect to the membership.php just because it was moved to within a folder if the config.php (with the same connection code as before) would not connect?

It seems to me, if the config.php path was configured right, that the chain of inlcudes would not be effected and be connected. Could I be wrong? Could the query not see the database connection because the membership.php was moved to within a folder and has to pull the connection code accross that new path?
russia5 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-05-2006, 12:18 PM Re: My path changed...
Webmaster Talker

Posts: 626
Trades: 0
You have to post the code so that we can see it.
jim.thornton is offline
Reply With Quote
View Public Profile
 
Old 07-05-2006, 02:01 PM Re: My path changed...
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
When you use php includes, you should use the file server path rather than the url http path so it can retrieve the php values rather than parsed output.
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 07-05-2006, 06:17 PM Re: My path changed...
Skilled Talker

Posts: 76
Trades: 0
Thanks guys... I think the Server Path thing is my problem. I am still getting an error but it is going in the right direction. Here is the php function that I have in my index.php

<?php
if (empty($_GET['action']))
{
if (empty($_REQUEST['id']))
include('home/accountname/public_html/abc.php');
else
include('home/accountname/public_html/xyz.php');
}
else
{
switch ($_GET['action']) {
case 'subscribe':
$query = 'INSERT INTO Profile_mailinglist (email, code, status) VALUES ("'.$_POST['subemail'].'", "1200", "1")';
mysql_query($query);
echo 'Your email address '.$_POST['subemail'].' is subscribed successfully';
break;
case 'unsubscribe':
$query = 'UPDATE Profile_mailinglist SET status = "0" WHERE email = "'.$_POST['subemail'].'"';
mysql_query($query);
echo 'Your email address '.$_POST['subemail'].' is unsubscribed successfully';
break;
}
}
?>

The errors I am getting are:
Warning: main(home/myaccount/public_html/abc.php) failed to open stream: No such file or directory in /home/myaccount/public_html/index.php on line 83

Warning: main(): Failed opening 'home/myaccount/public_html/abc.php' for inclusion (include_path='../usr/lib/php:/usr/local/lib/php') in /home/myaccount/public_html/member/index.php on line 83

Line 83 is include ('home/myaccount/public_html/abc.php') from above.

Now, to me, it does not make sense to replace line 83 with the ../usr/lib/php:/usr/local/lib/php' from above. How do I incorporate this.

Thanks

Last edited by russia5; 07-05-2006 at 06:27 PM..
russia5 is offline
Reply With Quote
View Public Profile
 
Old 07-05-2006, 07:04 PM Re: My path changed...
stOx's Avatar
Machine

Latest Blog Post:
Worlds Smallest Car - Peel P50
Posts: 2,111
Name: Matt. (>',')>
Location: London, England.
Trades: 0
Shouldn't it be -- include ('/home/myaccount/public_html/abc.php') ?
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
stOx is offline
Reply With Quote
View Public Profile Visit stOx's homepage!
 
Old 07-06-2006, 06:47 PM Re: My path changed...
Skilled Talker

Posts: 76
Trades: 0
Hey Thanks... that did it. The errors have gone away, the links seem to work and the includes seem to be included. But I still have a problem with the image paths. I am getting the famous x's for incomplete image paths. It is sticking the member folder name in the path. (the member folder is the new folder that I moved the file to. The file was outside of all folders) I can put the page graphic images inside the folder, however, the real problem comes with the images delivered by MySQL.

This code is on the new member file that is placed inside the new folder:

<?
include_once ("/home/myaccount/public_html/abc.php");
$root_path = "";
$filename = "index.php";
?>

I played with root path a bit, but I do not see where it is used so it may not do anything.

Here is a copy of my config.php

<?php
// pathes and files
$absolutepath = 'http://mysite.com/';
$imagemagik_path = '';
$imgSize = 100;
$original_max_size = '600x600';
$thumb_size1 = '100x100';
$thumb_size2 = '300x300';

$deleteOldestCount = 500;

// admins login and passwords
$admi['admin'] = '';
$gsPerRaw = 5; // how many g to display per 1 raw
$gPerPage = 20;

$imagesPerRaw = 3; // how many images to display per 1 raw
mysql_connect("localhost", "_", "") or die(mysql_error());
mysql_select_db("_") or die(mysql_error());
?>


However, this configuration form has to work with my home page. Could it be that I should have to make a configuration for the member folder? ( the new folder that I have made that I have transfered the file abc.php from above)

I believe the problem of image paths getting the /member/ folder into the path has to be between these two pieces of code. However, if someone has another idea, please let me know. Thanks...
russia5 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to My path changed...
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23920 seconds with 12 queries