html image in php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
duranike
Forum Newbie
Posts: 17
Joined: Tue Nov 04, 2003 8:40 pm

html image in php

Post by duranike »

why is this page being pulled up blank?


Code: Select all

<?php
//short variables
$submit = $_POST['submit'];
$username = $_POST['alias'];
$serial = $_POST['serial'];

$host = '*********';
$dbusername = '*********';
$dbpass = '*********';
$dbname = '*********';

	if (!$username || !$serial)
	{
		echo "<table border="1"> 
		<tr> 
			<td> 
				</td> 
					<td> 
			<img src="http://www.go-l.com/_images/error_fill_user_serial.gif"> 
				</A></td> 
				</tr> 
			</table> 
		"; //End ech
	}
	else
	{
		$conn = mssql_connect($host, $dbusername, $dbpass) or die('Error: MSSQL 
connection');
		mssql_select_db($dbname) or die('Error: Database Selection');
		$query = "SELECT * FROM support_101 where alias = '$username' AND serial = 
'$serial' ";
		$result = mssql_query($query) or die('Error: Query');
		$num_rows = mssql_num_rows($result);
		if ($num_rows > 0)
		{
			mssql_close($conn);
			require_once 'hollywood.php';
			header ('Location: http://www.go-l.com/support/hollywood.php');
		}
		else
		{
			echo 'Your username and/or serial number do not match our records. Please try again.';
			exit;
		}
	}
		$sql = "SELECT ALIAS FROM support_101 WHERE ALIAS='$ALIAS'";
		$sql_result = mssql_query($sql, $connection)
		or die ("Couldn't execute query.");
?>
[Admin Edit: tags added for clarity.][/b]
SBukoski
Forum Contributor
Posts: 128
Joined: Wed May 21, 2003 10:39 pm
Location: Worcester, MA

Post by SBukoski »

First, it would be wise to use the code tags so it is easier for people to read your code. Also, indentation helps, at least for me.

Does the image actually exist? One of the things I always do when I see a blank page is view the source. Sometimes doing that helps me figure out what I was doing wrong.
duranike
Forum Newbie
Posts: 17
Joined: Tue Nov 04, 2003 8:40 pm

Post by duranike »

sorry. yeah the image exists. any help anyone?

Code: Select all

<?php
//short variables
$submit = $_POST&#1111;'submit'];
$username = $_POST&#1111;'alias'];
$serial = $_POST&#1111;'serial'];

$host = ################;
$dbusername = '################';
$dbpass = '1################';
$dbname = '################]';

	if (!$username || !$serial)
	&#123;
		echo "<table border="1"> 
		<tr> 
			<td> 
				</td> 
					<td> 
			<img src="http://www.go-l.com/_images/error_fill_user_serial.gif"> 
				</A></td> 
				</tr> 
			</table> 
		"; //End ech
	&#125;
	else
	&#123;
		$conn = mssql_connect($host, $dbusername, $dbpass) or die('Error: MSSQL 
connection');
		mssql_select_db($dbname) or die('Error: Database Selection');
		$query = "SELECT * FROM support_101 where alias = '$username' AND serial = 
'$serial' ";
		$result = mssql_query($query) or die('Error: Query');
		$num_rows = mssql_num_rows($result);
		if ($num_rows > 0)
		&#123;
			mssql_close($conn);
			require_once 'hollywood.php';
			header ('Location: http://www.go-l.com/support/hollywood.php');
		&#125;
		else
		&#123;
			echo 'Your username and/or serial number do not match our records. Please try again.';
			exit;
		&#125;
	&#125;
		$sql = "SELECT ALIAS FROM support_101 WHERE ALIAS='$ALIAS'";
		$sql_result = mssql_query($sql, $connection)
		or die ("Couldn't execute query.");
?>
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

Code: Select all

<?php
//short variables 
$submit = $_POST['submit']; 
$username = $_POST['alias']; 
$serial = $_POST['serial']; 

$host = ################; 
$dbusername = '################'; 
$dbpass = '1################'; 
$dbname = '################]'; 

   if (!$username || !$serial) 
   { 
      echo "<table border="1"> 
      <tr><td><img src="http://www.go-l.com/_images/error_fill_user_serial.gif"></td> 
            </tr></table>"; //End ech 
   } 
   else 
   { 
      $conn = mssql_connect($host, $dbusername, $dbpass) or die('Error: MSSQL 
connection'); 
      mssql_select_db($dbname) or die('Error: Database Selection'); 
      $query = "SELECT * FROM support_101 where alias = '$username' AND serial = 
'$serial' "; 
      $result = mssql_query($query) or die('Error: Query'); 
      $num_rows = mssql_num_rows($result); 
      if ($num_rows > 0) 
      { 
         mssql_close($conn); 
         require_once 'hollywood.php'; 
         header ('Location: http://www.go-l.com/support/hollywood.php'); 
      } 
      else 
      { 
         echo 'Your username and/or serial number do not match our records. Please try again.'; 
         exit; 
      } 
   } 
      $sql = "SELECT ALIAS FROM support_101 WHERE ALIAS='$ALIAS'"; 
      $sql_result = mssql_query($sql, $connection) 
      or die ("Couldn't execute query."); 
?>
give this a try...you have some extra tags in your html code.
Post Reply