Forum Moderators: coopster
I am well aware that this is an issue that has been answered several times over and over throughout the glaxy of the internet ;) And believe me I have searched and searched, tried just about every single suggestion out there but still cannot fix this error.
I have:
1. Put in the .mysql_error() for error trapping but it does not stop on any of them
2. Echoed an actual variable from the table to see if it is pulling any rows from the table - it is.
3. Tried putting '' around either the column name or the table name or both in my mysql_query statement - didnt help.
4. Run the statment directly in phpMyAdmin to see if it the returned result is what I need - it is.
5. Made sure that the column name is spelled correctly AND has lower case letters - Format and punctuation both match.
I am at a loss as to where to go from here. Any help would be GREATLY appreciated! And if its something really simple that I totally missed, please forgive me as I have had very little sleep due to this ;)
<?php
// Connecting to the database
require_once("config.php");
$conn;
$select_db;
//getting info from the table mobster
$query = mysql_query("SELECT chr_name FROM mobster") or die ("This is the query error: ".mysql_error());
//Putting the results in an array
$result = mysql_fetch_array($query) or die ("This is the result error: ".mysql_error());
echo $result['chr_name'];
$nRows = mysql_num_rows($result) or die ("This is the nRows error: ".mysql_error());
//getting the rows
$rString = "&varNum=" . $nRows;
for ($i = 0; $i < $nRows; $i++){
$row = mysql_fetch_array($result);
$rString.=
"&varMobster$i=".$row['chr_name'];
}
echo $rString;
?>
MM