navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Dreamweaver CS3 PHP Error

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> Dreamweaver Help >> Dreamweaver CS3 PHP Error
Page: [1]
 
sentinel

 

Posts: 566
Joined: 5/4/2005
From: Chicago, Illinois
Status: offline

 
Dreamweaver CS3 PHP Error - 5/22/2007 9:27:52   
Hey all...

I am using Dreamweaver CS3 for extracting data into a PHP page froma MySQL database. The problem I am encountering is that i can only get the first record in any table. My page will show the first row of data with the folllowing warning:

mysql_fetch_assoc(): 4 is not a valid MySQL result resource

Here is my code.

<?php require_once('Connections/hcportal.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
  $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

mysql_select_db($database_hcportal, $hcportal);
$query_Recordset1 = "SELECT * FROM users";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $hcportal) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

if (isset($_GET['totalRows_Recordset1'])) {
  $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
  $all_Recordset1 = mysql_query($query_Recordset1);
  $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;

mysql_free_result($Recordset1);
?>
<table border="1" cellpadding="2" cellspacing="2">
  <tr>
    <td>UserID</td>
    <td>x_Firstname</td>
    <td>x_Lastname</td>
    <td>UserName</td>
    <td>x_Email</td>
    <td>EmailUse</td>
    <td>Password</td>
    <td>AddDatetime</td>
    <td>UpdateDatetime</td>
    <td>AccessLevel</td>
    <td>Admin</td>
    <td>ActiveAccount</td>
    <td>AccountExpires</td>
    <td>RemoteAddress</td>
    <td>LoginCount</td>
    <td>x_Company</td>
    <td>x_Address</td>
    <td>x_City</td>
    <td>x_State</td>
    <td>x_Zip</td>
    <td>x_Country</td>
    <td>x_Phone</td>
    <td>x_Cellphone</td>
    <td>x_Fax</td>
    <td>x_Website</td>
    <td>x_Userfound</td>
    <td>x_Spare</td>
    <td>x_RefId</td>
    <td>x_Trans_id</td>
    <td>x_Auth_Code</td>
    <td>u_id</td>
    <td>x_Sex</td>
    <td>Comments</td>
    <td>photo</td>
    <td>Groups</td>
    <td>Novell</td>
    <td>BirthdayMonth</td>
    <td>BirthdayDay</td>
    <td>About</td>
    <td>ForumCount</td>
    <td>ForumSig</td>
  </tr>
  <?php do { ?>
    <tr>
      <td><?php echo $row_Recordset1['UserID']; ?></td>
      <td><?php echo $row_Recordset1['x_Firstname']; ?></td>
      <td><?php echo $row_Recordset1['x_Lastname']; ?></td>
      <td><?php echo $row_Recordset1['UserName']; ?></td>
      <td><?php echo $row_Recordset1['x_Email']; ?></td>
      <td><?php echo $row_Recordset1['EmailUse']; ?></td>
      <td><?php echo $row_Recordset1['Password']; ?></td>
      <td><?php echo $row_Recordset1['AddDatetime']; ?></td>
      <td><?php echo $row_Recordset1['UpdateDatetime']; ?></td>
      <td><?php echo $row_Recordset1['AccessLevel']; ?></td>
      <td><?php echo $row_Recordset1['Admin']; ?></td>
      <td><?php echo $row_Recordset1['ActiveAccount']; ?></td>
      <td><?php echo $row_Recordset1['AccountExpires']; ?></td>
      <td><?php echo $row_Recordset1['RemoteAddress']; ?></td>
      <td><?php echo $row_Recordset1['LoginCount']; ?></td>
      <td><?php echo $row_Recordset1['x_Company']; ?></td>
      <td><?php echo $row_Recordset1['x_Address']; ?></td>
      <td><?php echo $row_Recordset1['x_City']; ?></td>
      <td><?php echo $row_Recordset1['x_State']; ?></td>
      <td><?php echo $row_Recordset1['x_Zip']; ?></td>
      <td><?php echo $row_Recordset1['x_Country']; ?></td>
      <td><?php echo $row_Recordset1['x_Phone']; ?></td>
      <td><?php echo $row_Recordset1['x_Cellphone']; ?></td>
      <td><?php echo $row_Recordset1['x_Fax']; ?></td>
      <td><?php echo $row_Recordset1['x_Website']; ?></td>
      <td><?php echo $row_Recordset1['x_Userfound']; ?></td>
      <td><?php echo $row_Recordset1['x_Spare']; ?></td>
      <td><?php echo $row_Recordset1['x_RefId']; ?></td>
      <td><?php echo $row_Recordset1['x_Trans_id']; ?></td>
      <td><?php echo $row_Recordset1['x_Auth_Code']; ?></td>
      <td><?php echo $row_Recordset1['u_id']; ?></td>
      <td><?php echo $row_Recordset1['x_Sex']; ?></td>
      <td><?php echo $row_Recordset1['Comments']; ?></td>
      <td><?php echo $row_Recordset1['photo']; ?></td>
      <td><?php echo $row_Recordset1['Groups']; ?></td>
      <td><?php echo $row_Recordset1['Novell']; ?></td>
      <td><?php echo $row_Recordset1['BirthdayMonth']; ?></td>
      <td><?php echo $row_Recordset1['BirthdayDay']; ?></td>
      <td><?php echo $row_Recordset1['About']; ?></td>
      <td><?php echo $row_Recordset1['ForumCount']; ?></td>
      <td><?php echo $row_Recordset1['ForumSig']; ?></td>
    </tr>
    <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>



Any idea what I am doing wrong?

Thanks

Rich

_____________________________

No matter where you go, there you are.
sentinel

 

Posts: 566
Joined: 5/4/2005
From: Chicago, Illinois
Status: offline

 
* Solved: RE: Dreamweaver CS3 PHP Error - 5/22/2007 10:05:56   
quote:

mysql_free_result($Recordset1);


I didn't realize I had freed the results before I had finished with them!

_____________________________

No matter where you go, there you are.

(in reply to sentinel)
mar0364

 

Posts: 3063
Joined: 4/5/2002
From: Florida, US
Status: online

 
RE: * Solved: RE: Dreamweaver CS3 PHP Error - 5/22/2007 11:45:09   
Sorry I posted this in the wrong place.

Well I'm glad I could help. :)

_____________________________

Easy Web

“Stay committed to your decisions, but stay flexible in your approach.”


(in reply to sentinel)
Page:   [1]

All Forums >> Web Development >> Dreamweaver Help >> Dreamweaver CS3 PHP Error
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts