Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

w2ksp4.exe, WwwxxXdbf, procmail "FROM_MAILER" patch, Use of assignment to $[ is deprecated at /usr/local/sbin/apxs line 86. , wwwxxx vim, mysql closing table and opening table, 800c5000, setgid operation not permitted, pciehp: acpi_pciehprm on IBM, WWWXXX.DBF

Links

XODOX
Impressum

#1: Help With Pulling Data From Database

Posted on 2008-04-18 02:55:45 by John

I'm trying to get this page to work but need assistance.

-------------------------------
CODE--------------------------------------
<?php
$GLOBALS["FF_GLOBALS_VERBOSE"] = true; // For debugging purposes
include("database.php");

ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);

$conn = mysql_connect("localhost", "jcweb##_test", "test") or
die(mysql_error());
mysql_select_db("jcweb06_test", $conn) or die(mysql_error());

$appt_date = $_POST['appt_month'] . '/' . $_POST['appt_day'] . '/' .
$_POST['appt_year'];
$phone = $_POST['phone1'] . '-' . $_POST['phone2'] . '-' .
$_POST['phone3'];
$appt_time = $_POST['appt_time'];


$query = "SELECT appt_date, appt_time FROM pest_control WHERE
appt_date = '$appt_date' and appt_time = '$appt_time'";


$result = mysql_query ($query);
if(mysql_num_rows($results) > 0)
{
echo "Success";
}
else
}
echo "No Records Returned";
}
?>
-----------------------------------------END
CODE-------------------------------------------------------- ------

When I do a print or echo of the variables I have set it does return
data so I think the problem is in my SQL statement. I have tried
everything I could think of but the page just returns blank and
doesn't print my message.

Any help is appreciated.

Report this message

#2: Re: Help With Pulling Data From Database

Posted on 2008-04-18 03:20:42 by Jerry Stuckle

John wrote:
> I'm trying to get this page to work but need assistance.
>
> -------------------------------
> CODE--------------------------------------
> <?php
> $GLOBALS["FF_GLOBALS_VERBOSE"] = true; // For debugging purposes
> include("database.php");
>
> ini_set ('display_errors', 1);
> error_reporting (E_ALL & ~E_NOTICE);
>
> $conn = mysql_connect("localhost", "jcweb##_test", "test") or
> die(mysql_error());
> mysql_select_db("jcweb06_test", $conn) or die(mysql_error());
>
> $appt_date = $_POST['appt_month'] . '/' . $_POST['appt_day'] . '/' .
> $_POST['appt_year'];
> $phone = $_POST['phone1'] . '-' . $_POST['phone2'] . '-' .
> $_POST['phone3'];
> $appt_time = $_POST['appt_time'];
>
>
> $query = "SELECT appt_date, appt_time FROM pest_control WHERE
> appt_date = '$appt_date' and appt_time = '$appt_time'";
>
>
> $result = mysql_query ($query);
> if(mysql_num_rows($results) > 0)
> {
> echo "Success";
> }
> else
> } <=== This should be a LEFT brace.
> echo "No Records Returned";
> }
> ?>
> -----------------------------------------END
> CODE-------------------------------------------------------- ------
>
> When I do a print or echo of the variables I have set it does return
> data so I think the problem is in my SQL statement. I have tried
> everything I could think of but the page just returns blank and
> doesn't print my message.
>
> Any help is appreciated.
>

See comments above. This is why you should have your error settings in
the .ini file. Syntax errors mean nothing is ever executed, so you
won't get the errors displayed.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Report this message

#3: Re: Help With Pulling Data From Database

Posted on 2008-04-18 10:38:20 by luiheidsgoeroe

On Fri, 18 Apr 2008 02:55:45 +0200, John <john.conklin@cox.net> wrote:
> $result =3D mysql_query ($query);
> if(mysql_num_rows($results) > 0)

$result !=3D $results .....

> {
> echo "Success";
> }
> else
> }

As Jerry said. { instead of }
-- =

Rik Wasmus

Report this message

#4: Re: Help With Pulling Data From Database

Posted on 2008-04-20 05:12:58 by John

On Apr 18, 1:38=A0am, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Fri, 18 Apr 2008 02:55:45 +0200, John <john.conk...@cox.net> wrote:
> > $result =3D mysql_query ($query);
> > if(mysql_num_rows($results) > 0)
>
> $result !=3D $results .....
>
> > {
> > =A0 =A0 echo "Success";
> > }
> > else
> > }
>
> As Jerry said. { instead of }
> --
> Rik Wasmus

Thank's Rik and Jerry, appreciate your help.

~John

Report this message