Script not echoing out anything..
Posted: Thu Jun 12, 2003 9:16 pm
alright, the source of my script is :
Anyways, what it's basically doing is running almost perfectly, but with two glitches:
One: the echo's dont do anything, not even the successfully edited page one.
Two: the homeurl and awayurl section of the site is not working correctly, nothing gets added into the database.
Code: Select all
<?php
include "./common.inc";
$link_id = db_connect();
if(!$link_id) die(sql_error());
if(!$topmidsubject) die("Please fill out something for the top mid subject");
if(!$topmidtext) die("Please fill out something for the top-mid text");
if(!$midsubject) die("Please fill out something for the mid subject");
if(!$midtext) die("Please fill out something for the mid text");
if(!$toplefttext) die("Please fill out something for the top left text");
//toplefttext
$query = "SELECT * FROM topleft_$tablename";
$result = mysql_query($query);
if(!mysql_num_rows($result)) {
$query = "INSERT INTO topleft_$tablename SET text = '$toplefttext';";
mysql_query($query);
}
if(mysql_num_rows($result)) {
$query = "UPDATE topleft_$tablename SET text = '$toplefttext' WHERE text = '$toplefttext_old';";
mysql_query($query);
}
//topmidsubject
$query = "SELECT subject FROM topmid_$tablename";
$result = mysql_query($query);
if(!mysql_num_rows($result)) {
$query = "INSERT INTO topmid_$tablename SET subject = '$topmidsubject';";
mysql_query($query);
}
if(mysql_num_rows($result)) {
$query = "UPDATE topmid_$tablename SET subject = '$topmidsubject' WHERE subject = '$topmidsubject_old';";
mysql_query($query);
}
//topmidtext
$query = "SELECT text FROM topmid_$tablename";
$result = mysql_query($query);
if(!mysql_num_rows($result)) {
$query = "INSERT INTO topmid_$tablename SET text = '$topmidtext';";
mysql_query($query);
}
if(mysql_num_rows($result)) {
$query = "UPDATE topmid_$tablename SET text = '$topmidtext' WHERE text = '$topmidtext_old';";
mysql_query($query);
}
//midsubject
$query = "SELECT subject FROM midsubject_$tablename";
$result = mysql_query($query);
if(!mysql_num_rows($result)) {
$query = "INSERT INTO midsubject_$tablename SET subject = '$topmidsubject';";
mysql_query($query);
}
if(mysql_num_rows($result)) {
$query = "UPDATE midsubject_$tablename SET subject = '$midsubject' WHERE subject = '$midsubject_old';";
mysql_query($query);
}
//midtext
$query = "SELECT text FROM midtext_$tablename";
$result = mysql_query($query);
if(!mysql_num_rows($result)) {
$query = "INSERT INTO midtext_$tablename SET text = '$midtext';";
mysql_query($query);
}
if(mysql_num_rows($result)) {
$query = "UPDATE midtext_$tablename SET text = '$midtext' WHERE text = '$midtext_old';";
mysql_query($query);
}
//midpic-home
$query = "SELECT homeurl FROM midpic_$tablename";
$result = mysql_query($query);
if(!mysql_num_rows($result)) {
$query = "INSERT INTO midpic_$tablename SET homeurl = 'images/$homejersey';";
mysql_query($query);
echo $query;
}
if(mysql_num_rows($result)) {
$query = "UPDATE midpic_$tablename SET homeurl = 'images/$homejersey' WHERE text = 'images/$homejersey_old';";
mysql_query($query);
echo $query;
}
//midpic-away
$query = "SELECT awayurl FROM midpic_$tablename";
$result = mysql_query($query);
if(!mysql_num_rows($result)) {
$query = "INSERT INTO midpic_$tablename SET awayurl = 'images/$awayjersey';";
mysql_query($query);
echo $query;
}
if(mysql_num_rows($result)) {
$query = "UPDATE midpic_$tablename SET awayurl = 'images/$awayjersey' WHERE text = 'images/$awayjersey_old';";
mysql_query($query);
echo $query;
}
echo "Successfully edited page";
?>One: the echo's dont do anything, not even the successfully edited page one.
Two: the homeurl and awayurl section of the site is not working correctly, nothing gets added into the database.