Private Label and Cobranded VoIP Solutions
BrainCast internet & phone based message/memo recording & reminder organization system
Internet Phone Service and Broadband Phone Service by ViaTalk

Go Back   VoIP Forums, Internet Phone Service Forums, & Web Hosting Forums > CoderForums - Programming Discussion > General Programming Issues > Programming Languages & Technologies > PHP

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-25-2002, 10:11 PM
nickut nickut is offline
Registered User
 
Join Date: Jun 2001
Location: Austin, TX
Posts: 19
Send a message via AIM to nickut
mySQL Errors

I am attempting to get a php script to work with mySQL. However, I continue to receive an error that I am unfamilar with:

Warning: Supplied argument is not a valid MySQL-Link resource in /home/wxquest/public_html/PHP/content/headlines.php on line 10

Warning: Supplied argument is not a valid MySQL result resource in /home/wxquest/public_html/PHP/content/headlines.php on line 12



Can anyone help me with this and what it means exactly?

Thanks.
__________________
nickut
-----------------------------
WeatherQuests, Inc.
http://www.weatherquests.com

Last edited by nickut; 02-26-2002 at 02:34 PM.
Reply With Quote
  #2  
Old 02-25-2002, 11:40 PM
fatal fatal is offline
SeXy Customer
 
Join Date: Feb 2002
Posts: 23
give some code above and below line 29
Reply With Quote
  #3  
Old 02-26-2002, 12:05 AM
Damian
Guest
 
Posts: n/a
Yes please post some code.

BTW, fellow Austin TX'er here

D
Reply With Quote
  #4  
Old 02-26-2002, 02:04 AM
nickut nickut is offline
Registered User
 
Join Date: Jun 2001
Location: Austin, TX
Posts: 19
Send a message via AIM to nickut
Sorry...my head is not all there at the moment!

Here is the entire code:

1 <?php
2
3 include "include_fns.php";
4 include "header.php";
5
6 $conn = db_connect();
7
8
9 $pages_sql = "select * from pages order by code";
10 $pages_result = mysql_query($pages_sql, $conn);
11
12 while ($pages = mysql_fetch_array($pages_result)) {
13
14 $story_sql = "select * from stories
15 where page = '$pages[code]'
16 and published is not null
17 order by published desc";
18 $story_result = mysql_query($story_sql, $conn);
19 if (mysql_num_rows($story_result)) {
20 $story = mysql_fetch_array($story_result);
21 print "<TABLE BORDER=0 WIDTH=400>";
22 print "<TR>";
23 print "<TD ROWSPAN=2 WIDTH=100>";
24 if ($story[picture])
25 print "<IMG SRC=\"resize_image.php?image=$story[picture]\">";
26 print "</TD>";
27 print "<TD>";
28 print "<H3>$pages[description]</H3>";
29 print $story[headline];
30 print "</TD>";
31 print "</TR>";
32 print "<TR><TD ALIGN=RIGHT>";
33 print "<A HREF=\"page.php?page=$pages[code]\">";
34 print "<FONT SIZE=1>Read more $pages[code] ...</FONT>";
35 print "</A>";
36 print "</TABLE>";
37 }
38 }

include "footer.php";
?>


Thanks for the help!

--> and Damian...a Longhorn I would hope!?!
__________________
nickut
-----------------------------
WeatherQuests, Inc.
http://www.weatherquests.com

Last edited by nickut; 02-26-2002 at 02:38 PM.
Reply With Quote
  #5  
Old 02-26-2002, 01:45 PM
Stewart's Avatar
Stewart Stewart is offline
That's me!
 
Join Date: Jun 2001
Location: UK
Posts: 376
the error you're getting tends to mean that there is either no table, column or row that you are trying to request.
__________________
Stewart Whiting

Need computer or network help? Come to http://www.coreworldstech.com
Reply With Quote
  #6  
Old 02-26-2002, 02:40 PM
nickut nickut is offline
Registered User
 
Join Date: Jun 2001
Location: Austin, TX
Posts: 19
Send a message via AIM to nickut
That was my first thought as to what is occurring, but all the appropriate tables, rows and columns are there with correct names and case. Very strange I must say...but then again something must be wrong?!
__________________
nickut
-----------------------------
WeatherQuests, Inc.
http://www.weatherquests.com

Last edited by nickut; 02-26-2002 at 02:57 PM.
Reply With Quote
  #7  
Old 02-26-2002, 07:04 PM
fatal fatal is offline
SeXy Customer
 
Join Date: Feb 2002
Posts: 23
6 $conn = db_connect();

what does that function return?
Reply With Quote
  #8  
Old 02-26-2002, 07:27 PM
nickut nickut is offline
Registered User
 
Join Date: Jun 2001
Location: Austin, TX
Posts: 19
Send a message via AIM to nickut
It's basically supposed to make sure that the database is connected.

But..what I have been trying to do and as you can tell quite unsuccesful is exactly what you have on your site fatal.
From you page http://www.fataldesigns.com/v4/ you have links int he flash header that go to other pages (i.e. members) but the link is http://www.theascendancy.net/v4/inde...ection=members thus using the same general page layout as the main page. I want to setup a system like this on my site, where php will pull the appropriate content from the database based on the url extensions (i.e. ?section=members) of the link and apply it to the default page design 'index.php'.

Do you know of an easy way to do this or know about an online tutorial somewhere because the way that I'm approaching this is obviously NOT working.

Thanks!!
__________________
nickut
-----------------------------
WeatherQuests, Inc.
http://www.weatherquests.com
Reply With Quote
  #9  
Old 02-28-2002, 04:56 PM
fatal fatal is offline
SeXy Customer
 
Join Date: Feb 2002
Posts: 23
http://www.fataldesigns.com/v4/ does not use a database, that was one of my first sites using php and simple includes.

http://www.fataldesings.com/md/ fully utilizes an Access2000 database

http://www.alanpowell.net/ fully utilizes MySQL database

Both those have the construct you're looking for, as in ?secion=mysection but also integrates database for data storage, retrieval, and organization.

The logic is really simple for the includes:
PHP Code:
if ($section == "home") {
    include(
"scripts/home.php"); }
else if (
$section == "news") {
    include(
"scripts/news.php"); }
else if (
$section == "somesection") {
    include(
"scripts/somesection.php"); }
else { include(
"scripts/home.php"); } 
if you always have file names same as the variable (Ex. $section variable has the same name as the file being include), you could just use:
PHP Code:
if (file_exists("scripts/$section.php")) include("scripts/$section.php"); 
else include(
"scripts/home.php"); 
All that does is the inclusion of certain scripts depending on the $section variable, all the database stuff is handled in the scripts its calling.

Hope that helps and if thats what you were lookin for
Reply With Quote
  #10  
Old 03-01-2002, 07:05 PM
nickut nickut is offline
Registered User
 
Join Date: Jun 2001
Location: Austin, TX
Posts: 19
Send a message via AIM to nickut
Thanks fatal...that's pretty much what I am looking for!
__________________
nickut
-----------------------------
WeatherQuests, Inc.
http://www.weatherquests.com
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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
Forum Jump