• You are not logged in. | Login

Post a reply

January 19, 2007 12:11 pm

monkeydude
Member
Ranks

Info output

Poll table has two columns - ask and answer

Answer column has the following values:
answe1
answer2
answer3

When execute that code

$mysqlanswer3=mysql_query("SELECT * from Poll");
while($row=mysql_fetch_row($mysqlanswer3))
{
unset($row[0]);
$row[1]=rtrim($row[1]);
$row[1]=ltrim($row[1]);
$row=implode(" ",$row);
print $row; 
print ' <input type=radio name=p><br>';
}

the result is:

<input type=radio name=p><br>answer1 <input type=radio name=p><br>answer2 <input type=radio name=p><br>answer3 <input type=radio name=p><br>

Last edited by monkeydude (January 19, 2007 12:13 pm)


 

 

January 19, 2007 12:17 pm

phppat
Member
Ranks

Re: Info output

I have two questions:
1. The main one: How many line does Poll table have?
2. What does it mean?

$row[1]=rtrim($row[1]);
$row[1]=ltrim($row[1]);
$row=implode(" ",$row);

????


PHP monster

 

 

January 19, 2007 2:32 pm

monkeydude
Member
Ranks

Re: Info output

1)Table Poll has one line
2)We can change to foreach


 

 

January 19, 2007 2:36 pm

phppat
Member
Ranks

Re: Info output

1) I can't understand
If table Poll has one line how we can have 4 &lt;input type=radio name=p&gt;?
2) How can we change the construction to foreach and what for?


PHP monster

 

 

January 23, 2007 7:43 am

phppat
Member
Ranks

Re: Info output

How many lines does Poll table have?


PHP monster

 

 

January 23, 2007 8:13 am

reetesh
Member
Ranks

Re: Info output

Column ask has value "question"
Column answer "answer1 answer2 answer3"

One line


 

 

January 23, 2007 9:16 am

phppat
Member
Ranks

Re: Info output

Please
Learn how to work with the database, find out what does script you gave do:
 

$newsSQL="CREATE TABLE Poll (ask TEXT,answer TEXT)";
...
$add="INSERT Poll(answer)VALUES('$_POST[$i]')"; /
$addm=mysql_query($add);
}

After that we'll keep on


PHP monster

 

 
  • Actions
  • Top
ITCrimea. Ukraine Web Development Company. Professional Developers and Web Designers Team
Custom Web Designs, Internet Applications, E-Commerce Websites, Interactive Sites, Database-Driven Sites and Services