dtm32236
08-27-2008, 01:34 PM
Hey guys,
I have a database that I can't edit... a screenshot of it is attached.
This db has a unique 'subscriber_id' for each person, and it stores their first name under 'field_id' 1 and the last name under 'field_id' 2.... if I'm saying that correctly. The attached image should help explain that.
I want to query this database so that it outputs the first name and last name, then a <br>
So far I have the following code (very simple):
<?php
$con = mysql_connect("localhost","xxx","xxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("pintmeis_pmsignup", $con);
$result = mysql_query("SELECT `pm_subscriber_data`.* FROM pm_subscriber_data WHERE field_id='1'");
while($row = mysql_fetch_array($result))
{
echo $row['value'];
echo "<br />";
}
mysql_close($con);
?>
And this correctly displays the first name. But I have no idea how to make it display the last name.
I tried this (and other variations of it):
WHERE field_id='1' OR field_id='2'
but this outputs the first name and last name on separate lines, and it orders the names wrong in many cases.
I'm at a loss here... any help would be much appreciated.
Thanks so much!
I have this code executed on this page if it helps:
http://www.pintmeisters.com/subscribers.php
EDIT: forgot to attach image
I have a database that I can't edit... a screenshot of it is attached.
This db has a unique 'subscriber_id' for each person, and it stores their first name under 'field_id' 1 and the last name under 'field_id' 2.... if I'm saying that correctly. The attached image should help explain that.
I want to query this database so that it outputs the first name and last name, then a <br>
So far I have the following code (very simple):
<?php
$con = mysql_connect("localhost","xxx","xxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("pintmeis_pmsignup", $con);
$result = mysql_query("SELECT `pm_subscriber_data`.* FROM pm_subscriber_data WHERE field_id='1'");
while($row = mysql_fetch_array($result))
{
echo $row['value'];
echo "<br />";
}
mysql_close($con);
?>
And this correctly displays the first name. But I have no idea how to make it display the last name.
I tried this (and other variations of it):
WHERE field_id='1' OR field_id='2'
but this outputs the first name and last name on separate lines, and it orders the names wrong in many cases.
I'm at a loss here... any help would be much appreciated.
Thanks so much!
I have this code executed on this page if it helps:
http://www.pintmeisters.com/subscribers.php
EDIT: forgot to attach image