homepage Welcome to WebmasterWorld Guest from 54.205.99.71
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Notice: Undefined index: name
using OOP
ricksum




msg:4653660
 1:02 pm on Mar 13, 2014 (gmt 0)

I'm having trouble determining where the probolem is. The fields all exist in the database here's the code:

$rs = "SELECT homeowners.last AS last, homeowners.Address AS address, statlog.ip_address AS ip, statlog.date_and_time AS date, \n"
. "statlog.city AS city, statlog.browser\n"
. "FROM homeowners\n"
. "INNER JOIN statlog ON homeowners.ip = statlog.ip_address\n"
. "ORDER BY date DESC , homeowners.last LIMIT 0, 300 ";

$rs=$conn->query($sql);

if($rs === false) {
trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);
} else {
$statlog_rows = $rs->num_rows;
}

// Iterate over recordset
// Using column names - recommended

$rows_returned = $rs->num_rows;
echo "<b>There were $rows_returned Rows Returned</b>";


echo "<table border='1'>";
echo "<tr>";
echo "<th>Last Name</th>";
echo "<th>Address</th>";
echo "<th>IP</th>";
echo "<th>Date</th>";
echo "<th>City</th>";
echo "<th>Browser</th>";
echo "<tr>";

$rs->data_seek(0);
while($row = $rs->fetch_assoc()){

echo "</td><td>";
echo $row['homeowners.last'];
echo "</td><td>";
echo $row['name'];
echo "</td><td>";
echo $row['email'];
echo "</td><td>";
echo $row['contribution'];
echo "</td><td>";
echo $row['method'];
echo "</td><td>";
echo "</td></tr>";

}
}

What am I missing? Help please. Thank you1

 

Readie




msg:4653668
 1:24 pm on Mar 13, 2014 (gmt 0)

"SELECT homeowners.last AS last, homeowners.Address AS address, statlog.ip_address AS ip, statlog.date_and_time AS date, \n"
. "statlog.city AS city, statlog.browser\n"
. "FROM homeowners\n"

The only fields available are what you select. So the above would only give you:

echo $row['last'];
echo $row['address'];
echo $row['ip'];
echo $row['date'];
echo $row['city'];
echo $row['browser'];

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved