what am I doing wrong ???

General discussions related to php

Moderators: macek, egami, gesf

Godiwa
New php-forum User
New php-forum User
Posts: 40
Joined: Wed Mar 05, 2003 5:55 am

what am I doing wrong ???

Postby Godiwa » Sat May 10, 2003 12:13 pm

I have this code, it works perfectly fine, BUT when I add the last row from the DB then it wont work and returns a blank pag, what goes wrong ???

Code: Select all

<?php
   session_start();   
   if (!isset($HTTP_SESSION_VARS['login'])){
   header ('Location: login.php');
    exit;
   }
      elseif (!$_POST["isseen"]) {
      //Show search form
      include ("includes/config.inc");
      include ("includes/searchfosterform.inc");
   }
   else {
      //Do search
         include ("includes/config.inc");
      $formresult = $_POST["search"];
      $selection = $_POST["selection"];
            
      $link = mysql_connect($server, $dbuser, $dbpass)
           or die("Could not connect: " . mysql_error());
       //print ("Connected successfully<br>");
      mysql_select_db($database, $link)
         or die("Could not select database: " . mysql_error());
      //print ("Database Selected<br>");
      $result = mysql_query("SELECT * FROM foster WHERE $selection ='$formresult'");
      while ($row  =  mysql_fetch_array($result)) {
         $id = $row["ID"];
         $name = $row["Firstname"];
         $surname = $row["Lastname"];
         $address = $row["Address"];
         $city = $row["City"];
         $zipcode = $row["Zipcode"];
         $state = $row["State"];
         $phone = $row["Phone"];
         $email = $row["Email"];
         $homepage = $row["Homepage"];
         $membermonth = $row["Membermonth"];
         $memberyear = $row["Memberyear"];
         $nextmonth = $row["Nextmonth"];
         $nextyear = $row["Nextyear"];
         $foster = $row["Foster"];
         $fosterselect = $row["Fosterselect"];
         $approvedby = $row["Approvedby"];
         $approveddate = $row["Approveddate"];
         $lastinspected = $row["Lastinspected"];
         $transport = $row["Transport"];
         $traileroption = $row["Traileroption"];
         $transportradius = $row["Transportradius"];
         $approvedby2 = $row["Approvedby2"];
         $approveddate2 = $row["Approveddate2"];
         $lastinspected2 = $row["Lastinspected2"];
         $inspector = $row["Inspector"];
         $approveinspector = $row["Approveinspector"];
         //$notes $row["Notes"];
         }
         include ("includes/resultfoster.inc");
         
      }
?>


this is the nonworking code:

Code: Select all

<?php
   session_start();   
   if (!isset($HTTP_SESSION_VARS['login'])){
   header ('Location: login.php');
    exit;
   }
      elseif (!$_POST["isseen"]) {
      //Show search form
      include ("includes/config.inc");
      include ("includes/searchfosterform.inc");
   }
   else {
      //Do search
         include ("includes/config.inc");
      $formresult = $_POST["search"];
      $selection = $_POST["selection"];
            
      $link = mysql_connect($server, $dbuser, $dbpass)
           or die("Could not connect: " . mysql_error());
       //print ("Connected successfully<br>");
      mysql_select_db($database, $link)
         or die("Could not select database: " . mysql_error());
      //print ("Database Selected<br>");
      $result = mysql_query("SELECT * FROM foster WHERE $selection ='$formresult'");
      while ($row  =  mysql_fetch_array($result)) {
         $id = $row["ID"];
         $name = $row["Firstname"];
         $surname = $row["Lastname"];
         $address = $row["Address"];
         $city = $row["City"];
         $zipcode = $row["Zipcode"];
         $state = $row["State"];
         $phone = $row["Phone"];
         $email = $row["Email"];
         $homepage = $row["Homepage"];
         $membermonth = $row["Membermonth"];
         $memberyear = $row["Memberyear"];
         $nextmonth = $row["Nextmonth"];
         $nextyear = $row["Nextyear"];
         $foster = $row["Foster"];
         $fosterselect = $row["Fosterselect"];
         $approvedby = $row["Approvedby"];
         $approveddate = $row["Approveddate"];
         $lastinspected = $row["Lastinspected"];
         $transport = $row["Transport"];
         $traileroption = $row["Traileroption"];
         $transportradius = $row["Transportradius"];
         $approvedby2 = $row["Approvedby2"];
         $approveddate2 = $row["Approveddate2"];
         $lastinspected2 = $row["Lastinspected2"];
         $inspector = $row["Inspector"];
         $approveinspector = $row["Approveinspector"];
         $notes $row["Notes"];
         }
         include ("includes/resultfoster.inc");
         
      }
?>


You will see that the only difference is that the notes line have had the // removed, why don't it work? is there a limit ofthe number of rows you can pull out or what is the problem?

please help

Godiwa

User avatar
bezmond
Moderator
Moderator
Posts: 312
Joined: Sat Apr 05, 2003 4:33 am
Location: Mansfield, UK
Contact:

Postby bezmond » Sat May 10, 2003 2:12 pm

$notes $row["Notes"];


try

Code: Select all

$notes = $row["Notes"];


works a treat :)

Andrew

Godiwa
New php-forum User
New php-forum User
Posts: 40
Joined: Wed Mar 05, 2003 5:55 am

Postby Godiwa » Sun May 11, 2003 10:09 am

aah sheesh, I hate when I stare myself blind on stupid things like that but funny it is missing the = since I took the first line and copied it down and then changed the var names and such

Godiwa

User avatar
bezmond
Moderator
Moderator
Posts: 312
Joined: Sat Apr 05, 2003 4:33 am
Location: Mansfield, UK
Contact:

Postby bezmond » Sun May 11, 2003 10:46 am

hehe, don't worry... we all make silly mistakes *makes too many!*
It always helps to get another set of eyes reading :)

Andrew

User avatar
bezmond
Moderator
Moderator
Posts: 312
Joined: Sat Apr 05, 2003 4:33 am
Location: Mansfield, UK
Contact:

Postby bezmond » Wed May 14, 2003 12:31 pm

or I suppose you could also say "2 drunks are better than 1" lol


Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 1 guest

cron