Solved

Page displays blank

Posted on 2007-04-06
3
181 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
  • 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to dynamically set the form action using jQuery.
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 …

776 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