Hi all my variables are not being pulled from the server for some reason any clue why? I'm trying to link an image and some text from a PHP page. here is the code
// create variable to hold name of db that the table resides
$db_name = "cayema";
// create variable to hold name of table you are populating
$table_name = "Articles";
// add connection information
$connection = @mysql_connect("localhost", "cayema", "red27")
or die (mysql_error());
$db = @mysql_select_db($db_name,$connection) or die(mysql_error());
// perform some validation on value of $id make sure number exists in system
$chk_id = "SELECT a_id FROM $table_name WHERE a_id = \"$a_id\"";
//Create variable to hold result of mysql_query() function. Include @ to surpress warnings
//as well as the die () function to cause the script to end and a messager displays if query fails
$chk_id_res = @mysql_query($chk_id,$connection) or die ("Couldnt execute query.");
//create variable to count the number of rows within the result there should b 1
$chk_id_num = mysql_num_rows($chk_id_res);
// start and ifelse to deal with results, check row count correct answer is 1
if ($chk_id_num == "0") {
// if row count is zero the id is invalid redirect and exit script
header("Location: exit;
// Continue ifelse acting on valid result
} else {
// Create the sql statement select all fields of db except id for the record that has
// same ID value
$sql ="SELECT article_name, image, text FROM $table_name WHERE a_id = \"$a_id\"";
}
// Create a variable to hold result of sql query function. Include at sign
// to supress warnings, as well as the die() function error message if query fails
$result = @mysql_query($sql,$connection) or die ("aint gonna be able to do it");
// Start while loop to create array for $row variable for each record in result set
while ($row = mysql_fetch_array($result)) {
Get individual elements of the record and give them good names.
$article_name = $row[article_name];
$image = $row[image];
$text = $row[text];
// Close the while loop
}
?>
<html><head><title>My Website Management System: Read only details skizilled030907</title>
</head><body>
<h1>Test for current website template</h1>
<!-- Mingle html and php to show nice title with full name-->
<h2>Article Details for <? echo "$article_name"; ?></h2>
<!--Start a paragraph with a text label-->
<p> <strong>Article:</strong><br>
<table width="380" height="140" border=1>
<td><? echo "$image"; ?><? echo "$text"; ?>
</td></table>
<!--Add a link back to main menu rv-->
<br><br>
<p><a href="contact_menu.php">Return to the Main Menu RV</a></p>
</body></html>
// create variable to hold name of db that the table resides
$db_name = "cayema";
// create variable to hold name of table you are populating
$table_name = "Articles";
// add connection information
$connection = @mysql_connect("localhost", "cayema", "red27")
or die (mysql_error());
$db = @mysql_select_db($db_name,$connection) or die(mysql_error());
// perform some validation on value of $id make sure number exists in system
$chk_id = "SELECT a_id FROM $table_name WHERE a_id = \"$a_id\"";
//Create variable to hold result of mysql_query() function. Include @ to surpress warnings
//as well as the die () function to cause the script to end and a messager displays if query fails
$chk_id_res = @mysql_query($chk_id,$connection) or die ("Couldnt execute query.");
//create variable to count the number of rows within the result there should b 1
$chk_id_num = mysql_num_rows($chk_id_res);
// start and ifelse to deal with results, check row count correct answer is 1
if ($chk_id_num == "0") {
// if row count is zero the id is invalid redirect and exit script
header("Location: exit;
// Continue ifelse acting on valid result
} else {
// Create the sql statement select all fields of db except id for the record that has
// same ID value
$sql ="SELECT article_name, image, text FROM $table_name WHERE a_id = \"$a_id\"";
}
// Create a variable to hold result of sql query function. Include at sign
// to supress warnings, as well as the die() function error message if query fails
$result = @mysql_query($sql,$connection) or die ("aint gonna be able to do it");
// Start while loop to create array for $row variable for each record in result set
while ($row = mysql_fetch_array($result)) {
Get individual elements of the record and give them good names.
$article_name = $row[article_name];
$image = $row[image];
$text = $row[text];
// Close the while loop
}
?>
<html><head><title>My Website Management System: Read only details skizilled030907</title>
</head><body>
<h1>Test for current website template</h1>
<!-- Mingle html and php to show nice title with full name-->
<h2>Article Details for <? echo "$article_name"; ?></h2>
<!--Start a paragraph with a text label-->
<p> <strong>Article:</strong><br>
<table width="380" height="140" border=1>
<td><? echo "$image"; ?><? echo "$text"; ?>
</td></table>
<!--Add a link back to main menu rv-->
<br><br>
<p><a href="contact_menu.php">Return to the Main Menu RV</a></p>
</body></html>