Having an issue with $thisrow not returning a value, i am attempting to do some flash/sql/php guest book stuff and this is somewhat screwing me over on line 47 and 52
SQL table is named Guest with field Name
[code=php]<?php
include (“connect_proj2_gbook.inc”);
$name = $HTTP_POST_VARS[‘userName’];
$location = $HTTP_POST_VARS[‘userLoc’];
$comments = $HTTP_POST_VARS[‘userComm’];
if (isset($name)){
mysql_query(“INSERT INTO Guest(Name,Location,Comments) values (‘$name’,’$location’,’$comments’)”);
}
require_once(‘connectgbooki.inc’);
$link = mysql_connect($mysql[‘host’],
$mysql[‘username’],
$mysql[‘password’]);
mysql_select_db(“clouatre_guestbook”, $link);
$names = “SELECT Name FROM Guest”;
$result = mysql_query($names, $link);
//trouble shooting to make sure $result has a value
while ($query_data = mysql_fetch_row($result)) {
foreach ($query_data as $entry) {
echo $entry.”<br>”;
}
}
echo “test data stops here<br><br><br>”;
if(!result) {
die(“query failed” .mysql_error());
}
$numrows_name = mysql_num_rows($result);
$alldata = “guestcount=”;
$alldata .= $numrows_name;
$alldata .=”&”;
for ($i=1; $i<=$numrows_name; $i++){
$thisrow = mysql_fetch_array($result);
$alldata .=”Name”;
$alldata .=$i;
$alldata .=”=”;
$alldata .=urlencode($thisrow[‘Name’]);
if ($i<$numrows_name) {
$alldata .= “&”;
}
}
echo “this is thisrow”.$thisrow[‘Name’].”<br>”;
echo $alldata;
mysql_close($link);
?>