Jump to content

php loop?


pouncer

Recommended Posts

untested code, but this may work

 

<?php

Require('connect.db');

$query = "SELECT * FROM dvds ";
$results = mysql_query($query) OR DIE("Error In DataBase");
$num = mysql_num_fields($results);
$i = 0;
while ($i < $num) {

$type  = mysql_field_type($result, $i);
$name  = mysql_field_name($result, $i);

echo $name;
echo $type;

$i++;
};
?>

Link to comment
https://forums.phpfreaks.com/topic/40412-php-loop/#findComment-195553
Share on other sites

hmm mate, do i need a loop or anything? what about the mysql_query ?

 

Of course:

 

<?php
$link = mysql_connect('localhost', 'username', 'password') or die('Could not connect: ' . mysql_error());
mysql_select_db('database') or die('Could not select database');

$query = 'DESCRIBE pm_imps';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
   echo $line['Field'] . ' '.$line['Type'].'<br />' ;
}

mysql_free_result($result);
mysql_close($link);
?> 

 

Best,

 

Patrick

Link to comment
https://forums.phpfreaks.com/topic/40412-php-loop/#findComment-195705
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.