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;
?> 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
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
==================
Thanks you both for your reply and assistance - this is exactly what I
was missing. :-) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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;...
|
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
{
|
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...
|
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...
|
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...
|
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...
|
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,...
|
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...
|
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...
|
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
|
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...
|
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...
|
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,...
|
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,...
|
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...
| |