Hi.
I'm new to PHP and MySQL
I set up the server on windows XP pro IIS and I'm using dreamweaver along with some coding books.
This is the second time I have set up a server on XP. The first time everything worked fine...
one of the problems I am having is when trying to Repeat Region behavior.
when I just try to display the first record it works fine
here is the code I use for that....
<?php require_once('../Connections/CardGuard.php'); ?>
<?php
mysql_select_db($database_CardGuard, $CardGuard);
$query_Recordset1 = "SELECT * FROM cards";
$Recordset1 = mysql_query($query_Recordset1, $CardGuard) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
mysql_free_result($Recordset1);
?><?php echo $row_Recordset1['card_id']; ?>
But as soon as I try to use the Repeat Region behavior I get this error messaage "mysql_fetch_assoc(): 4 is not a valid MySQL result resource in c:\inetpub\wwwroot... on line 13"
this is the code I'm using
<?php require_once('../Connections/CardGuard.php'); ?>
<?php
mysql_select_db($database_CardGuard, $CardGuard);
$query_Recordset1 = "SELECT * FROM cards";
$Recordset1 = mysql_query($query_Recordset1, $CardGuard) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
mysql_free_result($Recordset1);
?><?php echo $row_Recordset1['card_id']; ?>
<?php do { ?>
<?php echo $row_Recordset1['issure_name']; ?>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
I was thinking that maybe I installed PHP wrong and it's not connecting with MySQL properly.
another bit of code I tried from my book is this.... I don't know if that is right though.
<?php
mysql_connect('localhost', 'root');
mysql_select_db('cardguard');
$query = "SELECT issuer_name FROM cards WHERE card_id = 2";
$result = mysql_query($query);
while ($row = mysql_fetch_object($result)) {
echo "$rows->issuer_name<br>\n";
}
?>
Thanks a tone!
Steve.