Include error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
YoussefSiblini
Forum Contributor
Posts: 206
Joined: Thu Jul 21, 2011 1:51 pm

Include error

Post by YoussefSiblini »

Hi I am trying to include a file which is connection into my sql database, but I am always geting this error:

Code: Select all

Warning: include(1) [function.include]: failed to open stream: No such file or directory in /home/areebanc/public_html/areeban/makeswap2.php on line 60
and this is line 60:

Code: Select all

include 'includes/' . $send_database . '.php' or die(mysql_error());
Why the warning is giving include(1) while it is not 1 inside?


Youssef
genix2011
Forum Commoner
Posts: 74
Joined: Tue Aug 02, 2011 4:00 pm

Re: Include error

Post by genix2011 »

Hi,

remove the or die [..] statement:

Code: Select all

include('includes/' . $send_database . '.php');
And also check the existence of the file and the file permissions.

Greets.
YoussefSiblini
Forum Contributor
Posts: 206
Joined: Thu Jul 21, 2011 1:51 pm

Re: Include error

Post by YoussefSiblini »

Thank you for your reply,
I removed it and I got this:

Code: Select all

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/areebanc/public_html/areeban/makeswap2.php on line 63
This is line 63:

Code: Select all

$productCount = mysql_num_rows($sql); 
Do you want me to add all the code.

Youssef
genix2011
Forum Commoner
Posts: 74
Joined: Tue Aug 02, 2011 4:00 pm

Re: Include error

Post by genix2011 »

Hi,

yes there seems to be an error in your mysql_query().
It's not returning an valid mysql result.

Greets.
YoussefSiblini
Forum Contributor
Posts: 206
Joined: Thu Jul 21, 2011 1:51 pm

Re: Include error

Post by YoussefSiblini »

Oh K I noticed some thing,
when I use the id (AUTO_INCREMENT) it work like:

Code: Select all

$sql = mysql_query("SELECT * FROM antiques WHERE id = 32 LIMIT 1");
But When I use :

Code: Select all

$sql = mysql_query("SELECT * FROM antiques WHERE track_ID = 6UKBle LIMIT 1");
Which is not AUTO_INCREMENT it does not work.

Youssef
YoussefSiblini
Forum Contributor
Posts: 206
Joined: Thu Jul 21, 2011 1:51 pm

Re: Include error

Post by YoussefSiblini »

I found the error:

Code: Select all

$sql = mysql_query("SELECT * FROM $send_table WHERE track_ID ='$track_ID' LIMIT 1");
When I added the quotations around '$track_ID' it worked fine :)

Thank youuuuu
Post Reply