SunQuest
 
           MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old January 20th, 2004, 03:40 AM
sickofcoding sickofcoding is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 5 sickofcoding User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
mysql_fetch_array():

hello everybody,
i've been stuck with this for a while and cannot find a way to solve it; i'll really appreciate your help. please take a look at it since i'm new to php. thank you!
my error is :
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/html/NcDB/mailForm.php on line 37



<?php require_once('Connections/connectdb.php'); ?>
<!--<? echo "$connectdb<br>\n";?>-->

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
</head>

<body>
<?
mysql_select_db($database_connectdb, $connectdb);
$sql0= "select ServiceGr from ServiceType where ServiceID=$serid";
$searchSql0 = mysql_query($sql0,$connectdb) or die(mysql_error());
$resultSearch0=mysql_fetch_array($searchSql0);

mysql_select_db($database_connectdb, $connectdb);
if('$resultSearch0[ServiceGr]'=="1")
{
$sql= "SELECT LinkID from Link where ServiceID=1";
$searchSql = mysql_query($sql,$connectdb) or die(mysql_error());
$resultSearch=mysql_fetch_array($searchSql);

mysql_select_db($database_connectdb, $connectdb);
$sql1= "SELECT ContactID from ContactMap where GroupID=$resultSearch[LinkID]";
$searchSql1 = mysql_query($sql1,$connectdb) or die(mysql_error());
$resultSearch1=mysql_fetch_array($searchSql1);

mysql_select_db($database_connectdb, $connectdb);
$sql2= "select ContactEmail from Contact where ContactID=$resultSearch1[ContactID]";
$searchSql2 = mysql_query($sql2,$connectdb) or die(mysql_error());
$resultSearch2=mysql_fetch_array($searchSql2);
//echo"$resultSearch2[ContactEmail]";
}
?>
<?php
// line 37 is here
while($resultSearch2=mysql_fetch_array($searchSql2 ))
{
?>
<form name="form1" method="post" action="">
<table width="75%" border="0">
<tr>
<td width="26%">Mail From:</td>
<td width="74%">&nbsp;</td>

</tr>
<tr>
<td>Mail To:</td>
<td>&nbsp;</td>
<?php echo" $resultSearch2[ContactEmail]";?>
</tr>
<tr>
<td>Bcc:</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Subject:</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="2"><textarea name="textarea"></textarea></td>
</tr>
<tr>
<td>&nbsp;</td>
<td> <input name="Sent" type="submit" value="Sent">
<input type="submit" name="Clear" value="Clear"></td>
</tr>
</table>
</form>
<?php
}
?>
</body>
</html>

Reply With Quote
  #2  
Old January 20th, 2004, 07:30 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
Typically, this means that you're not connected to the database or that you haven't passed the db handle to the calling function. Have you assigned the mysql_connect() return to a variable? If so, try passing that variable in your mysql_fetch_array() as the second parameter.

Reply With Quote
  #3  
Old January 20th, 2004, 09:18 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 4 m 48 sec
Reputation Power: 8
Which line is line 37?

In the past I've found the problem usually relates to a messed up SQL statement...

try adding:
or die("Error ".mysql_errno().": ".mysql_error()."\nQuery: $sql");

to the end of your mysql_query commands... also, change the $sql variable to your variables containing the SQL statement

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > mysql_fetch_array():


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway