473,387 Members | 1,569 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,387 software developers and data experts.

Result Set Problem - Really Weird.....

I am new to programming in PHP however, this should be a pretty
straight forward answer. I have three queries that I am pulling for a
content form page.

1) The Author List
2) The Content Page (pulls the PK, Title and the Description of the
content.
3) The Category List

When I attempt to pull the data the only result set I get back is from
the Item #1 query above. Now, I made sure that there is data in the
tables, but I still get no data back for the other two queries(????)

Is there something that I missing when connecting to PHP/MYSQL? Do I
need to take some additional steps??

Any help would be greatly appreciated. I've been struggling with this
problem for several hours now scratching my head why this is.

:-)

// here is the PHP Code I am using

<?php
$db = mysql_connect("$DB_SERVER", "$DB_SERVER_USERNAME",
"$DB_SERVER_PASSWORD");
mysql_select_db("$DB_DATABASE",$db);
//result set 1 - get members
$result_M=mysql_query("SELECT * FROM tblMembers",$db);
$myrow_M=mysql_fetch_assoc($result_M);
//result set 2 - get content ID
$result_C=mysql_query("SELECT * FROM tblContent WHERE
contentID=1",$db);
$myrow_C=mysql_query($result_C);
//result set 3 - get categories
$result_Cat=mysql_query("SELECT * FROM tblCat",$db);
$myrow_Cat=mysql_query($result_Cat);
//result set 1 - output
$memID =$myrow_M['memberID'];
$fname =$myrow_M['fname'];
$lname =$myrow_M['lname'];
//result set 2 - output
$contentID =$myrow_C['contentID'];
$Title =$myrow_C['Title'];
$e1m1 =$myrow_C['Descr'];
//result set 3 - output
$CatID = $myrow_Cat['CatID'];
$CatName = $myrow_Cat['CatName'];
echo ($memID);
echo ($fname);
echo ($lname);
echo ($contentID);
echo ($Title);
echo ($e1m1);
echo ($CatID);
echo ($CatName);

return false;

?>

Feb 20 '06 #1
3 1305
> When I attempt to pull the data the only result set I get back is from
the Item #1 query above. Now, I made sure that there is data in the
tables, but I still get no data back for the other two queries(????)
<snip> // here is the PHP Code I am using

<snip: lots of PHP code without error checking>

I suggest you ask the mysql_errno() mysql_error() functions first.

Best regards
Feb 20 '06 #2
coder wrote:
I am new to programming in PHP however, this should be a pretty
straight forward answer. I have three queries that I am pulling for a
content form page.

1) The Author List
2) The Content Page (pulls the PK, Title and the Description of the
content.
3) The Category List

When I attempt to pull the data the only result set I get back is from
the Item #1 query above. Now, I made sure that there is data in the
tables, but I still get no data back for the other two queries(????)

Is there something that I missing when connecting to PHP/MYSQL? Do I
need to take some additional steps??

Any help would be greatly appreciated. I've been struggling with this
problem for several hours now scratching my head why this is.

:-)

// here is the PHP Code I am using

<?php
$db = mysql_connect("$DB_SERVER", "$DB_SERVER_USERNAME",
"$DB_SERVER_PASSWORD");
mysql_select_db("$DB_DATABASE",$db);
//result set 1 - get members
$result_M=mysql_query("SELECT * FROM tblMembers",$db);
$myrow_M=mysql_fetch_assoc($result_M);
//result set 2 - get content ID
$result_C=mysql_query("SELECT * FROM tblContent WHERE
contentID=1",$db);
$myrow_C=mysql_query($result_C);
//result set 3 - get categories
$result_Cat=mysql_query("SELECT * FROM tblCat",$db);
$myrow_Cat=mysql_query($result_Cat);
//result set 1 - output
$memID =$myrow_M['memberID'];
$fname =$myrow_M['fname'];
$lname =$myrow_M['lname'];
//result set 2 - output
$contentID =$myrow_C['contentID'];
$Title =$myrow_C['Title'];
$e1m1 =$myrow_C['Descr'];
//result set 3 - output
$CatID = $myrow_Cat['CatID'];
$CatName = $myrow_Cat['CatName'];
echo ($memID);
echo ($fname);
echo ($lname);
echo ($contentID);
echo ($Title);
echo ($e1m1);
echo ($CatID);
echo ($CatName);

return false;

?>


Check the results from your queries. If FALSE is returned, you have an
error. Call mysql_errno() and mysql_error() to find out what it is, i.e.

$result_C=mysql_query("SELECT * FROM tblContent WHERE contentID=1",$db);
if ($result_C) (
$myrow_C=mysql_query($result_C);
}
else {
echo {"MySQL Error detected: " . mysql_error() . "<br>\n");
}

ALWAYS check the results of ANY call to MySQL!
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Feb 20 '06 #3
Thanks you both for your reply and assistance - this is exactly what I
was missing. :-)

Feb 21 '06 #4

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

Similar topics

4
by: Konrad | last post by:
In the part of code: $polecenie = "SELECT osoby.Id ,osoby.Imie , osoby.Nazwisko,osoby.Tytul,osoby.Email,adrespraca.Adres AS ap, adrespraca.KodPoczt AS...
0
by: Ethan | last post by:
I've been having some really weird problems with a very simple PHP app. I'm wondering if anyone can help me sort this out. I have a page that prints out the results of a MySQL query as an HTML...
3
by: Gonçalo Rodrigues | last post by:
Hi, I use the unittest module for testing a given module's functionality, by lumping several test classes and then at the end a simple if __name__ == "__main__": unittest.main() In one of...
2
by: ai lian | last post by:
The code is as the following: { double limit= 0.02*33.00; double limit1= 0.06*11.00; double limit2= 0.03*22.00; double limit3= 0.01*66.00; limit=(floor(limit*100))/100;...
3
by: Protoman | last post by:
I keep getting -1#INF from this code; I can't figure out what's wrong. #include <iostream> #include <cstdlib> #include <memory> using namespace std; class invalidArg {
2
by: Sandra Setz | last post by:
Hello, I have made a view in SQL Server, that consists of a join with another view and a table. That other view In Access, I have linked the view as a linked table. When I view the result...
47
by: fb | last post by:
Hi Everyone. Thanks for the help with the qudratic equation problem...I didn't think about actually doing the math...whoops. Anyway... I'm having some trouble getting the following program to...
12
by: Mick_fae_Glesga | last post by:
OK, the solution to this is probably blindingly obvious to everyone, but... surely it can't be right. I am compiling with borland bcc32 free compiler this piece of code is designed to identify...
0
by: P Pulkkinen | last post by:
Dear all, sorry, i know this code is far little too long to debug here, but there is really annoying logical error. If someone debugs this, I really offer warm virtual handshake. What this...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.