[PHP-DB] Problems with displaying results

2009-03-03 Thread Terion Miller
I have two queries one pulls out which users to use and the second pulls
those users orders
Looks something like this but is only pulling the first record:


$query =  SELECT `UserName`, `AdminID` FROM admin
  WHERE   Key1 =  'YES' ;

$result = mysql_query ($query) ;
$row = mysql_fetch_assoc($result);

//Reveal Variables for Debugging
// include(VariableReveal2.php);
 echo (Hello br);
//echo $row['AdminID'];
echo ($row['UserName']);




if ($row['Key1'] == NO) {
header (Location: Welcome.php?AdminID=$AdminIDmsg=Sorry, you do
not have access to that page.);
}

if (isset($_GET['SortBy'])) {$SortBy = $_GET['SortBy'];} else {$SortBy =
'WorkOrderID DESC';}
if (isset($_GET['Page'])) {$Page = $_GET['Page'];} else {$Page = 1;}

$PerPage = 30;
$StartPage = ($Page - 1) * $PerPage;

second query here is using the $row from the first (and yes I know
not to use *, just did so here to keep post shorter)

 $sql= SELECT * FROM workorders WHERE AdminID =
'.$row['AdminID'].' ;
  // $sql .= ORDER BY $SortBy LIMIT $StartPage, $PerPage;
  $result = mysql_query ($sql);
  $row2 = mysql_fetch_assoc($result);
  $Total = ceil(mysql_num_rows($result)/$PerPage);


So this works but only half way as it only displays the first record in
the table.




Thanks
Terion

Happy Freecycling
Free the List !!
www.freecycle.org
Over Moderation of Freecycle List Prevents Post Timeliness.

Twitter?
http://twitter.com/terionmiller

Facebook:
a href=http://www.facebook.com/people/Terion-Miller/1542024891;
title=Terion Miller's Facebook profile target=_TOPimg src=
http://badge.facebook.com/badge/1542024891.237.919247960.png; border=0
alt=Terion Miller's Facebook profile/a
Groucho Marx  - I have had a perfectly wonderful evening, but this wasn't
it.


[PHP-DB] Re: Problems with displaying results

2009-03-03 Thread Shawn McKenzie
Terion Miller wrote:
 I have two queries one pulls out which users to use and the second pulls
 those users orders
 Looks something like this but is only pulling the first record:
 
 
 $query =  SELECT `UserName`, `AdminID` FROM admin
   WHERE   Key1 =  'YES' ;
 
 $result = mysql_query ($query) ;
 $row = mysql_fetch_assoc($result);
 
 //Reveal Variables for Debugging
 // include(VariableReveal2.php);
  echo (Hello br);
 //echo $row['AdminID'];
 echo ($row['UserName']);
 
 
 
 
 if ($row['Key1'] == NO) {
 header (Location: Welcome.php?AdminID=$AdminIDmsg=Sorry, you do
 not have access to that page.);
 }
 
 if (isset($_GET['SortBy'])) {$SortBy = $_GET['SortBy'];} else {$SortBy =
 'WorkOrderID DESC';}
 if (isset($_GET['Page'])) {$Page = $_GET['Page'];} else {$Page = 1;}
 
 $PerPage = 30;
 $StartPage = ($Page - 1) * $PerPage;
 
 second query here is using the $row from the first (and yes I know
 not to use *, just did so here to keep post shorter)
 
  $sql= SELECT * FROM workorders WHERE AdminID =
 '.$row['AdminID'].' ;
   // $sql .= ORDER BY $SortBy LIMIT $StartPage, $PerPage;
   $result = mysql_query ($sql);
   $row2 = mysql_fetch_assoc($result);
   $Total = ceil(mysql_num_rows($result)/$PerPage);
 
 
 So this works but only half way as it only displays the first record in
 the table.
 
 
 
 
 Thanks
 Terion
 
 Happy Freecycling
 Free the List !!
 www.freecycle.org
 Over Moderation of Freecycle List Prevents Post Timeliness.
 
 Twitter?
 http://twitter.com/terionmiller
 
 Facebook:
 a href=http://www.facebook.com/people/Terion-Miller/1542024891;
 title=Terion Miller's Facebook profile target=_TOPimg src=
 http://badge.facebook.com/badge/1542024891.237.919247960.png; border=0
 alt=Terion Miller's Facebook profile/a
 Groucho Marx  - I have had a perfectly wonderful evening, but this wasn't
 it.
 

You need to lookup the mysql_fetch_assoc() function.  It only returns
one row from a result set that may contain multiple rows.  You need
something like:

while($row = mysql_fetch_assoc($result)) {
  // do something with $row
}

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: [PHP] Re: Problems with displaying results

2009-03-03 Thread Kyle Terry
On Tue, Mar 3, 2009 at 8:32 AM, Shawn McKenzie nos...@mckenzies.net wrote:

 Terion Miller wrote:
  I have two queries one pulls out which users to use and the second pulls
  those users orders
  Looks something like this but is only pulling the first record:
 
 
  $query =  SELECT `UserName`, `AdminID` FROM admin
WHERE   Key1 =  'YES' ;
 
  $result = mysql_query ($query) ;
  $row = mysql_fetch_assoc($result);
 
  //Reveal Variables for Debugging
  // include(VariableReveal2.php);
   echo (Hello br);
  //echo $row['AdminID'];
  echo ($row['UserName']);
 
 
 
 
  if ($row['Key1'] == NO) {
  header (Location: Welcome.php?AdminID=$AdminIDmsg=Sorry, you do
  not have access to that page.);
  }
 
  if (isset($_GET['SortBy'])) {$SortBy = $_GET['SortBy'];} else {$SortBy =
  'WorkOrderID DESC';}
  if (isset($_GET['Page'])) {$Page = $_GET['Page'];} else {$Page = 1;}
 
  $PerPage = 30;
  $StartPage = ($Page - 1) * $PerPage;
 
  second query here is using the $row from the first (and yes I
 know
  not to use *, just did so here to keep post shorter)
 
   $sql= SELECT * FROM workorders WHERE AdminID =
  '.$row['AdminID'].' ;
// $sql .= ORDER BY $SortBy LIMIT $StartPage, $PerPage;
$result = mysql_query ($sql);
$row2 = mysql_fetch_assoc($result);
$Total = ceil(mysql_num_rows($result)/$PerPage);
 
 
  So this works but only half way as it only displays the first record
 in
  the table.
 
 
 
 
  Thanks
  Terion
 
  Happy Freecycling
  Free the List !!
  www.freecycle.org
  Over Moderation of Freecycle List Prevents Post Timeliness.
  
  Twitter?
  http://twitter.com/terionmiller
  
  Facebook:
  a href=http://www.facebook.com/people/Terion-Miller/1542024891;
  title=Terion Miller's Facebook profile target=_TOPimg src=
  http://badge.facebook.com/badge/1542024891.237.919247960.png; border=0
  alt=Terion Miller's Facebook profile/a
  Groucho Marx  - I have had a perfectly wonderful evening, but this
 wasn't
  it.
 

 You need to lookup the mysql_fetch_assoc() function.  It only returns
 one row from a result set that may contain multiple rows.  You need
 something like:

 while($row = mysql_fetch_assoc($result)) {
  // do something with $row
 }

 --
 Thanks!
 -Shawn
 http://www.spidean.com

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

 You also need to filter your user inputted data.


Kyle Terry | www.kyleterry.com
Help kick start VOOM (Very Open Object Model) for a library of PHP classes.
http://www.voom.me | IRC EFNet #voom


Re: [PHP-DB] Re: Problems with displaying results

2009-03-03 Thread Terion Miller
On Tue, Mar 3, 2009 at 10:32 AM, Shawn McKenzie nos...@mckenzies.netwrote:

 Terion Miller wrote:
  I have two queries one pulls out which users to use and the second pulls
  those users orders
  Looks something like this but is only pulling the first record:
 
 
  $query =  SELECT `UserName`, `AdminID` FROM admin
WHERE   Key1 =  'YES' ;
 
  $result = mysql_query ($query) ;
  $row = mysql_fetch_assoc($result);
 
  //Reveal Variables for Debugging
  // include(VariableReveal2.php);
   echo (Hello br);
  //echo $row['AdminID'];
  echo ($row['UserName']);
 
 
 
 
  if ($row['Key1'] == NO) {
  header (Location: Welcome.php?AdminID=$AdminIDmsg=Sorry, you do
  not have access to that page.);
  }
 
  if (isset($_GET['SortBy'])) {$SortBy = $_GET['SortBy'];} else {$SortBy =
  'WorkOrderID DESC';}
  if (isset($_GET['Page'])) {$Page = $_GET['Page'];} else {$Page = 1;}
 
  $PerPage = 30;
  $StartPage = ($Page - 1) * $PerPage;
 
  second query here is using the $row from the first (and yes I
 know
  not to use *, just did so here to keep post shorter)
 
   $sql= SELECT * FROM workorders WHERE AdminID =
  '.$row['AdminID'].' ;
// $sql .= ORDER BY $SortBy LIMIT $StartPage, $PerPage;
$result = mysql_query ($sql);
$row2 = mysql_fetch_assoc($result);
$Total = ceil(mysql_num_rows($result)/$PerPage);
 
 
  So this works but only half way as it only displays the first record
 in
  the table.
 
 
 
 
  Thanks
  Terion
 
  Happy Freecycling
  Free the List !!
  www.freecycle.org
  Over Moderation of Freecycle List Prevents Post Timeliness.
  
  Twitter?
  http://twitter.com/terionmiller
  
  Facebook:
  a href=http://www.facebook.com/people/Terion-Miller/1542024891;
  title=Terion Miller's Facebook profile target=_TOPimg src=
  http://badge.facebook.com/badge/1542024891.237.919247960.png; border=0
  alt=Terion Miller's Facebook profile/a
  Groucho Marx  - I have had a perfectly wonderful evening, but this
 wasn't
  it.
 

 You need to lookup the mysql_fetch_assoc() function.  It only returns
 one row from a result set that may contain multiple rows.  You need
 something like:

 while($row = mysql_fetch_assoc($result)) {
  // do something with $row
 }

 ---

well I looked it up in my book and tried this example but still get the same
thing, the first record

$result = mysql_query ($query) ;
//$row = mysql_fetch_array($result);
while ($row = mysql_fetch_row($result)){
for ($i=0; $imysql_num_fields($result); $i++)
echo $row[$i] .  ;
//print a return for neatness sake
echo \n;


[PHP-DB] Re: [PHP] Re: [PHP-DB] Re: Problems with displaying results

2009-03-03 Thread Ashley Sheridan
On Tue, 2009-03-03 at 11:08 -0600, Terion Miller wrote:
 On Tue, Mar 3, 2009 at 10:32 AM, Shawn McKenzie nos...@mckenzies.netwrote:
 
  Terion Miller wrote:
   I have two queries one pulls out which users to use and the second pulls
   those users orders
   Looks something like this but is only pulling the first record:
  
  
   $query =  SELECT `UserName`, `AdminID` FROM admin
 WHERE   Key1 =  'YES' ;
  
   $result = mysql_query ($query) ;
   $row = mysql_fetch_assoc($result);
  
   //Reveal Variables for Debugging
   // include(VariableReveal2.php);
echo (Hello br);
   //echo $row['AdminID'];
   echo ($row['UserName']);
  
  
  
  
   if ($row['Key1'] == NO) {
   header (Location: Welcome.php?AdminID=$AdminIDmsg=Sorry, you do
   not have access to that page.);
   }
  
   if (isset($_GET['SortBy'])) {$SortBy = $_GET['SortBy'];} else {$SortBy =
   'WorkOrderID DESC';}
   if (isset($_GET['Page'])) {$Page = $_GET['Page'];} else {$Page = 1;}
  
   $PerPage = 30;
   $StartPage = ($Page - 1) * $PerPage;
  
   second query here is using the $row from the first (and yes I
  know
   not to use *, just did so here to keep post shorter)
  
$sql= SELECT * FROM workorders WHERE AdminID =
   '.$row['AdminID'].' ;
 // $sql .= ORDER BY $SortBy LIMIT $StartPage, $PerPage;
 $result = mysql_query ($sql);
 $row2 = mysql_fetch_assoc($result);
 $Total = ceil(mysql_num_rows($result)/$PerPage);
  
  
   So this works but only half way as it only displays the first record
  in
   the table.
  
  
  
  
   Thanks
   Terion
  
   Happy Freecycling
   Free the List !!
   www.freecycle.org
   Over Moderation of Freecycle List Prevents Post Timeliness.
   
   Twitter?
   http://twitter.com/terionmiller
   
   Facebook:
   a href=http://www.facebook.com/people/Terion-Miller/1542024891;
   title=Terion Miller's Facebook profile target=_TOPimg src=
   http://badge.facebook.com/badge/1542024891.237.919247960.png; border=0
   alt=Terion Miller's Facebook profile/a
   Groucho Marx  - I have had a perfectly wonderful evening, but this
  wasn't
   it.
  
 
  You need to lookup the mysql_fetch_assoc() function.  It only returns
  one row from a result set that may contain multiple rows.  You need
  something like:
 
  while($row = mysql_fetch_assoc($result)) {
   // do something with $row
  }
 
  ---
 
 well I looked it up in my book and tried this example but still get the same
 thing, the first record
 
 $result = mysql_query ($query) ;
 //$row = mysql_fetch_array($result);
 while ($row = mysql_fetch_row($result)){
 for ($i=0; $imysql_num_fields($result); $i++)
 echo $row[$i] .  ;
 //print a return for neatness sake
 echo \n;
What happens if you just change your while loop to this:

while($row = mysql_fetch_array($result))
{
print_r($row);
}


Ash
www.ashleysheridan.co.uk


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Need help in solving issues with configuration of php-5.2.8 with mysql-5.3.1

2009-03-03 Thread niranjan k
Hi,

I installed 64 bit MySQL-5.3.1 and i am in the process of installing php-5.2.8. 
While configuring php with mysql, getting following issues.

Issue:

1. I ran php configuration as below.

$./configure --with-apxs2=/usr/local/apache2/bin/apxs 
--with-mysql=/apps/mysql/mysql

It went fine.

2. While running make, i got following relink error.

ld: fatal: file /usr/local/mysql/lib/libmysqlclient.so: wrong ELF class: 
ELFCLASS64
ld: fatal: File processing errors. No output written to 
.libs/libphp5.so
collect2: ld returned 1 exit status
*** Error code 
1
make: Fatal error: Command failed for target `libphp5.la'

I tried exporting CFLAGS as export CFLAGS=$CFLAGS -m64 so that gcc will use 
64 bit.
But i got following error at the time of make.

ld: fatal: file ext/libxml/.libs/libxml.o: wrong ELF class: ELFCLASS32
ld: 
fatal: File processing errors. No output written to 
.libs/libphp5.so
collect2: ld returned 1 exit status
*** Error code 
1
make: Fatal error: Command failed for target `libphp5.la'

I am not able to proceed with the installation of PHP due to above errors. I 
would appreciate if any one can help me in resolving the issue.

Please let me know if you need more details in solving the issue.

Regards,
Niranjan





  

Re: [PHP-DB] Need help in solving issues with configuration of php-5.2.8 with mysql-5.3.1

2009-03-03 Thread chris smith
 1. I ran php configuration as below.

 $./configure --with-apxs2=/usr/local/apache2/bin/apxs
 --with-mysql=/apps/mysql/mysql

 It went fine.

Are you sure?

 2. While running make, i got following relink error.

 ld: fatal: file /usr/local/mysql/lib/libmysqlclient.so: wrong ELF class:
 ELFCLASS64

Look at the path of the file it picked up - it found one in a
completely different location.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Need help in solving issues with configuration of php-5.2.8 with mysql-5.3.1

2009-03-03 Thread niranjan k
Hi Chris,

Thanks for the response.

 1. I ran php configuration as below.

 $./configure --with-apxs2=/usr/local/apache2/bin/apxs
 --with-mysql=/apps/mysql/mysql

 It went fine.

Chris  Are you sure? 

Yes it went fine.

 2. While running make, i got following relink error.

 ld: fatal: file /usr/local/mysql/lib/libmysqlclient.so: wrong ELF class:
 ELFCLASS64

Chris  Look at the path of the file it picked up - it found one in a
completely different location.The path it has taken /usr/local/mysql/...
There is a soft link to /usr/local/mysql which points to /apps/mysql/mysql

Regards,
Niranjan

--- On Wed, 3/4/09, chris smith dmag...@gmail.com wrote:
From: chris smith dmag...@gmail.com
Subject: Re: [PHP-DB] Need help in solving issues with configuration of  
php-5.2.8 with mysql-5.3.1
To: niranjan_...@yahoo.com
Cc: php-db@lists.php.net
Date: Wednesday, March 4, 2009, 12:16 PM

 1. I ran php configuration as below.

 $./configure --with-apxs2=/usr/local/apache2/bin/apxs
 --with-mysql=/apps/mysql/mysql

 It went fine.

Are you sure?

 2. While running make, i got following relink error.

 ld: fatal: file /usr/local/mysql/lib/libmysqlclient.so: wrong ELF class:
 ELFCLASS64

Look at the path of the file it picked up - it found one in a
completely different location.

-- 
Postgresql  php tutorials
http://www.designmagick.com/