473,396 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Help With Pulling Data From Database

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.
Jun 2 '08 #1
3 1045
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.
js*******@attglobal.net
==================

Jun 2 '08 #2
On Fri, 18 Apr 2008 02:55:45 +0200, John <jo**********@cox.netwrote:
$result = mysql_query ($query);
if(mysql_num_rows($results) 0)
$result != $results .....
{
echo "Success";
}
else
}
As Jerry said. { instead of }
--
Rik Wasmus
Jun 2 '08 #3
On Apr 18, 1:38*am, "Rik Wasmus" <luiheidsgoe...@hotmail.comwrote:
On Fri, 18 Apr 2008 02:55:45 +0200, John <john.conk...@cox.netwrote:
$result = mysql_query ($query);
if(mysql_num_rows($results) 0)

$result != $results .....
{
* * echo "Success";
}
else
}

As Jerry said. { instead of }
--
Rik Wasmus
Thank's Rik and Jerry, appreciate your help.

~John
Jun 2 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Salad | last post by:
I am having a problem with linking to FoxPro DOS tables in Access2000. Simply opening the tables are EXTREMELY slow. Let me tell you how make my connections to these tables. I could easily be...
2
by: Jozef | last post by:
Hello, I'm trying to create a central function that runs a connection to an SQL Server database. The connection etc works, but when I try to call it, I get an error saying "Runtime-Error 91:...
2
by: Randel Bjorkquist | last post by:
I'm completely lost and need some help to understand how the Visual Studios data components work, deals with database, datsets, datasources, etc... I'm extremely new to Visual Studio and am having...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
3
by: Jim Hernandez | last post by:
This has set me back a couple of days now and I could really use some help or at least a shove in the right direction. What I'm trying to do is list reviews in a database on a page, by artist...
1
by: xx75vulcan | last post by:
I have created an ASP page that will "on the fly" create an XML feed from my MS SQL database and the contents within a specified table. The Feed: http://www.rockwood.k12.mo.us/news/rss.asp You...
0
by: HydroPnik | last post by:
Hi all! What a great community you have here. Being an Access newbie I have already used much information gleaned from the other posters for my current project. I have been tasked with creating a...
3
by: DeanL | last post by:
Hi guys, I'm in need of a little help with a report I'm setting up on Access 2000. The report shows data depending on entries on a form that has 7 fields (Min and Max Cost, Fiscal Year, Min and...
3
by: BobRoyAce | last post by:
I am using Visual Studio 2008 w/ VB.NET. For the database, I am using SQL Server 2005, which is running on a dedicated server box. I am creating a WinForms application for a client. It is run...
1
by: spriguy21 | last post by:
Hey y'all, I am in need of some help...I am building a internal website for my department and I am using JavaScript to pull data from a local database since our corp office is being stingy and...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.