MySQL - mysql_fetch_array?
#1

Hey,

I cant think of a way to display results from MySQL when querying something like this:

pawn Код:
mysql_query("SELECT * FROM people WHERE age = '15'");
mysql_store_result();

/*
Would i format it? or...
format(query, sizeof(query), "ID: %d | Name: %s | Age: %d | Gender: %s", id, name, age, gender);

I want to display the results like this:
-------------------------------------------¬
|ID: 1 | Name: Bob | Age: 15 | Gender: Male |
|ID: 2 | Name: Jay | Age: 15 | Gender: Male |
|ID: 3 | Name: Jim | Age: 15 | Gender: Male |
|ID: 4 | Name: Dan | Age: 15 | Gender: Male |
|ID: 5 | Name: Guy | Age: 15 | Gender: Male |
-------------------------------------------
*/


mysql_free_result();
Not really sure how to explain this, but in PHP it would be something like this:

PHP код:
$sql="SELECT * FROM people";
$result=mysql_query($sql);
while(
$rows=mysql_fetch_array($result)){
      
$age $rows['age'];
      echo 
$age;
}
mysql_close(); 
I'm currently using MySQL Plugin R6-2

Sorry if i didn't explain this clearly,

Thanks.
Reply


Messages In This Thread
MySQL - mysql_fetch_array? - by jamiesage123 - 14.01.2012, 23:26
Re: MySQL - mysql_fetch_array? - by Vince - 14.01.2012, 23:59
Re: MySQL - mysql_fetch_array? - by jamiesage123 - 15.01.2012, 00:21

Forum Jump:


Users browsing this thread: 1 Guest(s)