PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
apple
Forum Newbie
Posts: 21 Joined: Wed Mar 03, 2004 12:50 am
Contact:
Post
by apple » Sat Mar 20, 2004 2:24 am
Code: Select all
<?php
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
echo '<tr><td><a href=apple.php?id=$row[0]">';
echo "<align="left">" . stripslashes($row[1]) . "</a></td>";
echo "<td align="left">$row[2]</td>";
echo "<td align="left">$row[3]</td>";
echo "<td align="left">$row[4]</td>";
echo "</tr>";
?>
How can I put $row[0] to the apple.php?
Thanks in Advance.
andre_c
Forum Contributor
Posts: 412 Joined: Sun Feb 29, 2004 6:49 pm
Location: Salt Lake City, Utah
Post
by andre_c » Sat Mar 20, 2004 3:02 am
I don't quite understand what you are trying to do, can you elaborate?
markl999
DevNet Resident
Posts: 1972 Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)
Post
by markl999 » Sat Mar 20, 2004 6:00 am
echo '<tr><td><a href="apple.php?id='.$row[0].'">';
m3mn0n
PHP Evangelist
Posts: 3548 Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada
Post
by m3mn0n » Sat Mar 20, 2004 6:55 am
You pretty much had it right, maybe the problem is getting it from the URL?
How are you echoing/defining the variable $row[0] in the apple.php page?
markl999
DevNet Resident
Posts: 1972 Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)
Post
by markl999 » Sat Mar 20, 2004 6:57 am
The problem as i saw it was..
echo '<tr><td><a href=apple.php?id=$row[0]">';
The single quotes won't interpolate/evaluate $row[0] .. plus there's a stray " in there
m3mn0n
PHP Evangelist
Posts: 3548 Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada
Post
by m3mn0n » Sat Mar 20, 2004 7:00 am
And that's why I don't program this early/late.
I didn't catch that. heh
Apple, fix that parse error and see how things go.
apple
Forum Newbie
Posts: 21 Joined: Wed Mar 03, 2004 12:50 am
Contact:
Post
by apple » Sat Mar 20, 2004 9:43 am
Thanks!
doeboy
Forum Newbie
Posts: 10 Joined: Sun Mar 21, 2004 10:18 am
Post
by doeboy » Sun Mar 21, 2004 11:30 am
Instead of
echo '<tr><td><a href="apple.php?id='.$row[0].'">';
You could use {}
So
echo '<tr><td><a href="apple.php?id={$row[0]}">';
I would much rather do this than make sure I have the right amount/types of quotes.