PHP Classes

connect to mysql

Recommend this page to a friend!

      PHP Tree Graph  >  All threads  >  connect to mysql  >  (Un) Subscribe thread alerts  
Subject:connect to mysql
Summary:connect to mysql
Messages:1
Author:Ericka10
Date:2010-03-24 18:00:56
 

  1. connect to mysql   Reply   Report abuse  
Picture of Ericka10 Ericka10 - 2010-03-24 18:00:56
connect to mysql. I'm trying to connect to mysql demo2.php but only shows me the first record in the table. please help. I put the code here


<?php

/**
* phpTreeGraph
* Species hierarchy demo with images
* @author Mathias Herrmann
**/

//include GD rendering class
require_once('./classes/GDRenderer.php');

$connection = mysql_connect("localhost", "root", "123") or die (mysql_error());

mysql_select_db("sistrag", $connection) or die (mysql_error());


$result = mysql_query("select o.id_objetivo, o.padre, o.Nombre_objetivo from objetivo o where padre ='".$inicio."' ", $connection);

if($row = mysql_fetch_array($result))
{ $cantidad_filas = mysql_num_rows($result);
mysql_field_seek($result,0);



do{



//create new GD renderer, optinal parameters: LevelSeparation, SiblingSeparation, SubtreeSeparation, defaultNodeWidth, defaultNodeHeight
$objTree = new GDRenderer(30, 10, 30, 350, 20);

//add nodes to the tree, parameters: id, parentid optional title, text, width, height, image(path)
$objTree->add($row['id_objetivo'] , $row['padre'] ,$row['Nombre_objetivo'] );

$objTree->setNodeLinks(GDRenderer::LINK_BEZIER);

$objTree->setBGColor(array(255, 183, 111));
$objTree->setNodeTitleColor(array(0, 128, 255));
$objTree->setNodeTitleColor(array(0, 128, 255));
$objTree->setLinkColor(array(0, 64, 128));

$objTree->setTextTitleColor(array(255, 255, 255));
$objTree->setFTFont('./fonts/Vera.ttf', 12, 0, GDRenderer::CENTER|GDRenderer::TOP);

$objTree->stream();} while($row = mysql_fetch_array($result));
?>
<?php
}?>