no output at all -- can't see why in code (???)

This is a discussion on "no output at all -- can't see why in code (???)" within the PHP Forum section. This forum, and the thread "no output at all -- can't see why in code (???) are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Oct 15th, 2005, 09:15
Junior Member
Join Date: Sep 2005
Location: kNot in Kansas
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
no output at all -- can't see why in code (???)

i know i'm missing something really silly here, but i've just burned myself out on trying to find it. i'd really appreciate a little help from some fresh eyes. thanks!

Code: Select all
<?php
$conn = mysql_connect("localhost", "private", "private") or die(mysql_error());
mysql_select_db("cb_shows1", $conn) or die(mysql_error());
// MAKE DB CONNECTION
$a = 1;
$a = $a++;
if (isset($_POST['op']) and $_POST['op'] != "do_it") {
							  // BEGIN IF 'OP NOT EQUAL TO DO_IT' LOGIC

// BEGIN MAKING HTML BLOCK
	$outputhtml = "<h1>Associate Contact with Artist info</h1>
					  

Use the pull-downs to match Contact person
					  to the appropriate Artist</p>
					  <form method=\"post\" action=\"$_SERVER[PHP_SELF]\">
					  

<select name=\"contact_id\">
					  <option value=\"\">-- Contact Name --</option>";
					  
			// QUERY FOR CONCTACT ID AND NAME
			$contQuery = "select contact_id, contact_name from contact_info";
			$contShow = mysql_query($contQuery) or die(mysql_error());

		while ($contArray = mysql_fetch_array($contShow) or die(mysql_error()) ) {
																				  // START WHILE LOOP ONE
	
			$contId = $contArray[0]; 
            $contName = $contArray[1];	

	$outputhtml .= "<option value=\"$contId\">$contName</option>";
	    
		}
		// END WHILE LOOP ONE

	$outputhtml .= "</select></p>";

// QUERY FOR ARTIST ID AND NAME
$artQuery = "select artist_id, artist_name from artist_info";
$artShow = mysql_query($artQuery);

	$outputhtml .= "

Use this pull-down to match an Artist 
	                   with the Contact selected above</p>
					   

<select name=\"artist_id\">
					   <option value=\"\">-- Artist Name --</option>";
					   
		while ($artArray = mysql_fetch_array($artShow) or die(mysql_error()) ) {
																			    // START WHILE LOOP TWO
			$artId = $artArray['artist_id'];
			$artName = $artArray['artist_name'];
			
		$outputhtml .= "<option value=\"$artId\">$artName</option>";
		
		}
		// END WHILE LOOP TWO
			
		// MORE HTML VARIABLE CONCAT
		$outputhtml .= "</select></p>";
		
		$outputhtml .= "

When you are finished making your selections
						   simply hit the button below, and your selections will
						   be associated properly for future reference</p>
						   


						   <input type=\"submit\" name=\"submit\" 
						   value\"Assciate Contact &amp; Artist Now\" /></p>
						   <input type=\"hidden\" name=\"op\" value=\"do_it\" />
						   </form>";

		}
		// IF LOGIC PART TWO SHOULD ACTIVATE UPDATE QUERY AND ASSOCIATE ARTIST AND CONTACT
		 else if (isset($_POST['op']) and $_POST['op'] == "do_it") {
		
		// SQL -UPDATE ROW- FOR CHANGING ARTIST AND CONTACT ASSOCIATION
		$assQuery = "UPDATE artist_info SET contact_id='$_POST[contact_id]'WHERE artist_id='$_POST[artist_id]'";
		$contInfo = "select contact_name from contact_info where contact_id='$_POST[contact_id]'";
		$artInfo = "select artist_name from artist_info where artist_id='$_POST[artist_id]'";
		
		// PUT MYSQL QUERY RESULTS INTO ARRAYS
		$assup = mysql_query($assQuery) or die(mysql_error());
		$contRes = mysql_query($contInfo) or die(mysql_error());
		$artRes = mysql_query($artInfo) or die(mysql_error());
		
		// PULL NAMES FROM MYSQL RESULTS
		$contEntered = $contRes['contact_name'];
		$artEntered = $artRes['artist_name'];
		
		// PUT CHANGED INFO INTO NEW HTML BLOCK - SECOND TIME AROUND
		$outputhtml = "<h1>Success!</h1>
						  <h2>Results:</h2>
						  

 ".$artEntered."is now associated with
						  ".$contEntered." as their Contact</p>
						  

Click here to 
						  <a href=\"associate.php\">change more
						  </a> Artist / Contact associations</p>
						  

or go <a href=\"control.htm\">back to the main</a> control</p>";
						  
		}// END IF LOGIC PART TWO
?>
<html>
<head>
<title>Change Associated Contacts and Artists</title>
<link rel="STYLESHEET" type="text/css" href="css/php.css">
</head>
<body>


Results</p>
<?php 
echo $a;
echo "

".$outputhtml."</p>"; ?>
</body>
</html>
Reply With Quote

  #2 (permalink)  
Old Oct 15th, 2005, 22:44
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sypher
Can you narrow it down? What line number or variable are you getting the error with?
Reply With Quote
  #3 (permalink)  
Old Oct 15th, 2005, 22:50
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
I agree.... that would be pretty helpful.
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
Reply With Quote
  #4 (permalink)  
Old Oct 15th, 2005, 22:57
Junior Member
Join Date: Sep 2005
Location: kNot in Kansas
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
sypher, hey, thanks for the reply!

i think i have everything the same as you see it here, but i'll get in there and edit my previous post to reflect my current version too...

my output is showing from line 102, the html part after i closed the ?> php section, where i have:
</head>
<body>


results</p>

so, it IS giving me that lil HTML bit-- but then i get a PHP Notice "Undefined variable on 105, which is the <?php echo $outputhtml; ?> part. i have NO idea why it's saying there's nothing in that variable!! weird! it's driving me nuts! i've used quite similar script many times in this app, and it works fine-- so i'm just stumped.

far as i can tell, there is no screen output cause there is nothing for the code to output-- i just can't see or understand WHY there's "nothing" to output.

hmph.
Reply With Quote
  #5 (permalink)  
Old Oct 15th, 2005, 22:57
Junior Member
Join Date: Sep 2005
Location: kNot in Kansas
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by sypher
Can you narrow it down? What line number or variable are you getting the error with?
reason i didn't show that before, 'cause i am normall mindful of that stuff, is that i was LITERALLY getting NO OUTPUT
meaning, a white screen
/edit:
at the time that i posted that. since modified w/ the html bit of output

wait, i beg your pardon-- i'm confusing that w/ something else-- it's hard to remember, i have a lot of files w/ this app! i think i was just getting the undefinted variable 'op' Notice, which i didn't post cause i thought it didn't tell me much about what was going on. sorry 'bout that.
Reply With Quote
  #6 (permalink)  
Old Oct 16th, 2005, 00:23
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sypher
Well im know 100% confused from your posts :P Ill take a look at the code maybe ill find the prob.
Reply With Quote
  #7 (permalink)  
Old Oct 16th, 2005, 01:06
Junior Member
Join Date: Sep 2005
Location: kNot in Kansas
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by sypher
Ill take a look at the code maybe ill find the prob.
hehe... is there another way to find errors? if so tell me, and i'll start using that method!


i realize i've presented a convoluted story here-- allow me to explain once and for all what is the meaning of my previous posts.

this PHP script poduces no output except for the html at the bottom, which is not part of the PHP script, but which does have one line of PHP embedded.

this PHP script produces error report line:
Notice: Undefined variable: outputhtml in c:\...

and that's all that it does. that's what i mean by i'm getting no output. i realize how you read it. my fault for turning into such a riddle i guess.
Reply With Quote
  #8 (permalink)  
Old Oct 16th, 2005, 03:00
Reputable Member
Join Date: Sep 2005
Location: Canada, BC
Age: 24
Posts: 239
Thanks: 0
Thanked 0 Times in 0 Posts
My guess is that your if and else if are comeing up false, test this by throwing a
Code: Select all
else ( echo "OMG false!"; }
at the end, just to quickly test that possiblity.
Reply With Quote
  #9 (permalink)  
Old Oct 16th, 2005, 05:07
Junior Member
Join Date: Sep 2005
Location: kNot in Kansas
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
good idea. definitely better than my completely useless $a++ thing!

thanks...

(time passes few minutes...)

OMG False!!

you were 100% correct! okay... hehe now what...

well, this definitely narrows it down, that's for sure. how numb is my skull for missing that!
Reply With Quote
Reply

Tags
output, code

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Php output in to CSS dhossai Web Page Design 1 Oct 30th, 2007 18:38
delaying output theosx JavaScript Forum 6 Sep 19th, 2007 04:56
Distinct output using ASP/SQL bullrider Classic ASP 0 May 29th, 2007 16:55
displaying the output madhuri.t Classic ASP 3 Jul 12th, 2006 15:49
output IE vs. FF jojo Web Page Design 5 Dec 29th, 2005 13:35


All times are GMT. The time now is 05:34.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43