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
josh27
Forum Newbie
Posts: 7 Joined: Sat Feb 02, 2008 6:52 pm
Post
by josh27 » Tue Feb 05, 2008 3:50 pm
I have this code...
Code: Select all
<?php
$link=mysql_connect("localhost","db_test","test");
mysql_select_db("table_test",$link);
$sql="SELECT alumno_name, alumno_lastname, alumno_photo FROM Quinto_A_T1_N1";
$result=mysql_query($sql);
$i=0;
while ($row=mysql_fetch_array($result))
{
echo $row[$i]."<br>";
}
echo $row[$i]."<br>"; show me only the alumno_photo column, how i can get alumno_name and alumno_lastname, column?...
Ollie
Forum Newbie
Posts: 4 Joined: Sun Jan 20, 2008 5:46 pm
Location: Nottingham, UK
Post
by Ollie » Tue Feb 05, 2008 4:23 pm
You're not incrementing $i within the loop, so it's having no effect. But that wont solve your problem!
Rather than echoing $row[$i], I think you want to echo $row['alumno_name'], $row['alumno_lastname'] and $row['alumno_photo'].
The while ($row=mysql_fetch_array($result)) line proceeds through each row returned from the database, returning an array corresponding to that row.