Jump to content


Photo

I was trying to pull the names and the date form the same user fileld


  • Please log in to reply
9 replies to this topic

#1 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 18 April 2006 - 01:01 PM

This comes from the database and pulls the names correctly.
echo"<OPTION VALUE='".$record["name"]."'>".$record["name"];

I was trying to pull the names and the date from the same user fileld to show name and date from pull down together.

example but wrong can you help cheers.
echo"<OPTION VALUE='".$record["name"]."' '".$record["date"]."'>".$record["name"] $record["date"];

Advance thank you.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 18 April 2006 - 01:20 PM

And what happens or doesn't happen when you use that code?
Legend has it that reading the manual never killed anyone.
My site

#3 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 18 April 2006 - 01:21 PM



Keep getting a phase errow on that line.

[code=auto:0]

Parse error: parse error, expecting `','' or `';'' in C:\Program Files\Apache Group\Apache2\htdocs\collage\project\search.php on line 17

[code=auto:0]
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#4 craygo

craygo
  • Staff Alumni
  • Advanced Member
  • 1,973 posts
  • LocationRhode Island

Posted 18 April 2006 - 01:23 PM

you need to get rid of the single quotes. should be
echo"<OPTION VALUE='".$record["name"]." ".$record["date"]."'>$record['name'] $record['date']</OPTION>";

Ray


#5 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 18 April 2006 - 01:26 PM

[!--quoteo(post=365989:date=Apr 18 2006, 01:23 PM:name=craygo)--][div class=\'quotetop\']QUOTE(craygo @ Apr 18 2006, 01:23 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
you need to get rid of the single quotes. should be
echo"<OPTION VALUE='".$record["name"]." ".$record["date"]."'>$record['name'] $record['date']</OPTION>";

Ray
[/quote]
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\Program Files\Apache Group\Apache2\htdocs\collage\project\search.php on line 17

still wrong sorry
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#6 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 18 April 2006 - 01:40 PM

echo "<OPTION VALUE='". $record["name"]. " ". $record["date"]. "'>". $record['name'] $record['date']. "</OPTION>";

Legend has it that reading the manual never killed anyone.
My site

#7 craygo

craygo
  • Staff Alumni
  • Advanced Member
  • 1,973 posts
  • LocationRhode Island

Posted 18 April 2006 - 01:42 PM

Ya i see i tested my code out with just some variables above. This worked for me

echo"<OPTION VALUE='".$record['name']." ".$record['date']."'>".$record['name']." ".$record['date']."</OPTION>";

Ray

#8 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 18 April 2006 - 01:49 PM

Test it with a database to get name and date on the same pull down menu dosent work agree varables without database works.


The full code test it on a database dosent work but name on it's own does.
<html>
<head>
<title>search2</title>
<body>
search me via search box
<form  method="post" action="search_result.php">
<SELECT NAME="name">
<?
$db=mysql_connect("localhost","xxx","xxx");
mysql_select_db("schollwork", $db);
$query="select * from feedback";
$result=mysql_query($query);
while($record=mysql_fetch_assoc($result)){
echo "<OPTION VALUE='". $record["name"]. " ". $record["date"]. "'>". $record['name'] 
$record['date'].;
}

?>
</select>
<input type="submit" value="submit">
</form>
</body>
</html>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#9 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 18 April 2006 - 02:04 PM

echo "<OPTION VALUE='". $record["name"]. $record["date"]. "'>". $record['name']. "". $record['date']. "</OPTION>";
That works. You might want to separate the name and date with | to make it easier to split them later.

echo "<OPTION VALUE='". $record["name"]. $record["date"]. "'>". $record['name']. "|". $record['date']. "</OPTION>";

Legend has it that reading the manual never killed anyone.
My site

#10 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 18 April 2006 - 02:26 PM


Thank you andy in the end all i needed to see the date and not get the script to search via name and date cheers thanks so much.

<html>
<head>
<title>search2</title>
<body>
search me via search box
<form  method="post" action="search_result.php">
<SELECT NAME="name">
<?
$db=mysql_connect("localhost","xxxx","xxxx");
mysql_select_db("schollwork", $db);
$query="select * from feedback";
$result=mysql_query($query);
while($record=mysql_fetch_assoc($result)){

echo "<OPTION VALUE='". $record["name"]."'>". $record['name']. "  ". $record['date']. 

"</OPTION>";
}

?>
<input type="submit" value="submit">
</form>
</body>
</html>

[!--sizeo:6--][span style=\"font-size:24pt;line-height:100%\"][!--/sizeo--]solved[!--sizec--][/span][!--/sizec--]
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users