Solved

Page displays blank

Posted on 2007-04-06
3
187 Views
Last Modified: 2007-04-06
What's up experts.  Got a question for you.  The code I have seems to be fine, yet I am getting a blank page.  Can anyone tell me why?

<?php
$conn = mysql_connect("127.0.0.1", "", "");
mysql_select_db("providers", $conn)
or die(mysql_error());

if ($_GET['list'] == "list") {

$SQLstr2 = mysql_query("SELECT tblAdspace.providerID, tblAdspace.strCompanyname FROM tblAdspace" or die(mysql_error());

while ($row = mysql_fetch_array($SQLstr2)) {
      $providerID = $row['providerID'];
      $strCompanyname = $row['strCompanyname'];
}
}
?>
0
Comment
Question by:pingeyeg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 28

Expert Comment

by:gamebits
ID: 18863546
put error_reporting(E_ALL); at the top of the page to see if there is any error.
0
 
LVL 24

Accepted Solution

by:
glcummins earned 500 total points
ID: 18863553
There is an error in your query:

 $SQLstr2 = mysql_query("SELECT tblAdspace.providerID, tblAdspace.strCompanyname FROM tblAdspace" or die(mysql_error());

Should be:

 $SQLstr2 = mysql_query("SELECT tblAdspace.providerID, tblAdspace.strCompanyname FROM tblAdspace") or die(mysql_error());

There was a missing parenthesis after the query string.

While troubleshooting scripts, error reporting should be enabled on the server, if at all possible.
0
 
LVL 28

Expert Comment

by:gamebits
ID: 18863556
My first thought would be that "list" is not being set so the query is not getting done, you could add an else statement to the script else{echo " the variable is not set";}
0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question