Jump to content

[SOLVED] using dreamweaver to display a table..Warning: mysql_fetch_assoc(): supplied arg


Recommended Posts

Hello, I hope to find help here. I thank you in advance for your time and assistance.

I am a noob

I have installed xampp and use dreamweaver to edit mysql and php on my localhost machine.

 

I am attempting to do this tutorial I found on the web. which is just to display the details of a table.

http://www.nebulex.com/index.php/tutorials/dreamweaver/mysqlphp/dynamic%20Tables/46?

 

However I am getting an error

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\cats.php on line 25

 

Line 25 is..

<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>

 

here is the whole code block.

<table border="1" cellpadding="5" cellspacing="5">
  <tr>
    <td>id</td>
    <td>Name</td>
    <td>Sex</td>
    <td>DOB</td>
    <td>Mother</td>
    <td>Father</td>
    <td>Coat</td>
    <td>Color</td>
    <td>Vocal</td>
  </tr>
  <?php do { ?>
    <tr>
      <td><?php echo $row_Recordset1['id']; ?></td>
      <td><?php echo $row_Recordset1['Name']; ?></td>
      <td><?php echo $row_Recordset1['Sex']; ?></td>
      <td><?php echo $row_Recordset1['DOB']; ?></td>
      <td><?php echo $row_Recordset1['Mother']; ?></td>
      <td><?php echo $row_Recordset1['Father']; ?></td>
      <td><?php echo $row_Recordset1['Coat']; ?></td>
      <td><?php echo $row_Recordset1['Color']; ?></td>
      <td><?php echo $row_Recordset1['Vocal']; ?></td>
    </tr>
    <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<?php require_once('Connections/Insert.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;
}
}

mysql_select_db($database_Insert, $Insert);
$query_Recordset1 = "SELECT * FROM `index`";
$Recordset1 = mysql_query($query_Recordset1, $Insert) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

mysql_free_result($Recordset1);
?>

 

Thanks again for looking and any assistance you can give

Link to comment
Share on other sites

  • 1 month later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.