Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Lionsanime Directory   High Bandwidth Dedicated Servers   V7N Directory

Reply
 
LinkBack Thread Tools Display Modes
Old 12-18-2004, 02:29 PM   #1 (permalink)
Inactive
 
bytech's Avatar
 
Join Date: 10-13-03
Location: Manitoba, Canada
Posts: 573
iTrader: 0 / 0%
Latest Blog:
None

bytech is just really nicebytech is just really nicebytech is just really nicebytech is just really nicebytech is just really nicebytech is just really nicebytech is just really nicebytech is just really nicebytech is just really nicebytech is just really nice
Send a message via Skype™ to bytech
Running PHP Program From Another PHP Program

I think there has got to be an easy solution to this one:

I have two PHP programs. One (we'll call it progy1) displays the information from a database without conditions. My other program (progy2) has been writen by me to check the database records and check to see if a record should get displayed by progy1 (progy2 goes through all the records using a loop, checks that a field matches the area the user is in, and if there is a match I do a include/require of progy2).

Both programs run fine on their own. However, the call for progy1 from progy2 causes progy1 to die after the first matching record is found, and the following error is returned:

Quote:
Warning: 1 is not a valid MySQL-Link resource in /home/site/web/poll.php on line 108

Couldn't execute query: 31
poll.php is progy2. Any ideas how I can call/run progy1 in progy2 without running into this problem?
bytech is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 12-18-2004, 09:27 PM   #2 (permalink)
Inactive
 
insitedev's Avatar
 
Join Date: 12-14-04
Posts: 108
iTrader: 0 / 0%
Latest Blog:
None

insitedev is liked by somebodyinsitedev is liked by somebodyinsitedev is liked by somebodyinsitedev is liked by somebody
Can you post up some code for us to look at? It could be something along the lines of your query not being valid, or your overwriting your result variable. That, and it is saying "1 is not a valid...". Are you trying to set it to a numeric variable?

It could also be that your connection resource variable isn't defined in the function that you are using (assuming that you are using functions).

for instance, if you are using $dbh for your mysql_connect variable inside of a function, then calling something that uses $dbh from another function, it might not have access to it. If that is the case, add global $dbh; to the top of that second function.

If we could see the code that you are using, it would really help out.

Last edited by insitedev : 12-18-2004 at 09:35 PM.
insitedev is offline  
Add Post to del.icio.us
Reply With Quote
Old 12-19-2004, 07:11 AM   #3 (permalink)
Moderator
 
LazyJim's Avatar
 
Join Date: 10-13-03
Location: UK
Posts: 2,819
iTrader: 0 / 0%
Latest Blog:
None

LazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to allLazyJim is a name known to all
Send a message via MSN to LazyJim
If you're trying to loop through all the records and only display certain ones, then there's probably better ways.

Specifically, take the part of progy1 that makes the decision and make it into a function (coded into progy2) that is called from each iteration of the loop.

(that is if it cannot be done in SQL)
__________________

-LJ-

My advice is to look at each case individually, with an informed mind and an appropriately balanced and objective viewpoint.

Web Design and Development, Ipswich, UK.
My deviantArt
LazyJim is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
000webhosting.com there affiliate program is a FRAUD program - Beware! jingjong Affiliate Revenue 3 03-26-2008 05:43 PM
ERD program Pulse Coding Forum 0 02-08-2006 07:48 AM
3d program? Leader of Men Graphic Design Forum 8 12-19-2003 06:51 PM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 01:55 PM.
© Copyright 2008 V7 Inc