|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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%"> </td> </tr> <tr> <td>Mail To:</td> <td> </td> <?php echo" $resultSearch2[ContactEmail]";?> </tr> <tr> <td>Bcc:</td> <td> </td> </tr> <tr> <td>Subject:</td> <td> </td> </tr> <tr> <td colspan="2"><textarea name="textarea"></textarea></td> </tr> <tr> <td> </td> <td> <input name="Sent" type="submit" value="Sent"> <input type="submit" name="Clear" value="Clear"></td> </tr> </table> </form> <?php } ?> </body> </html> |
|
#2
|
||||
|
||||
|
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.
|
|
#3
|
||||
|
||||
|
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 |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > mysql_fetch_array(): |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|