Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2004
    Posts
    12

    Cool Unanswered: From Mysql to access codes:

    I have this code in php:
    Code:
    while($row = mysql_fetch_array($sql))
    I want to do the same thing as this, but using MS access.

    What would the ($row = mysql_fetch_array($sql) part look like?

    Thanks!

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    not everyone here is a PHP guru - can you explain what your PHP code is trying to achieve?

    izy
    currently using SS 2008R2

  3. #3
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Access doesn't use an array structure for the table, it hits it directly.

    try:

    While Not yourRecordSet.EOF

    Or are you saying you're hitting an access db via php? Then that's a question for the php guys.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  4. #4
    Join Date
    Jul 2004
    Posts
    12
    I'm using php to try and turn the code from using mysql to use access.
    The example i was given is:

    Code:
    while($row = mysql_fetch_array($sql)) 
    { 
    $data[] = $row[1]; 
    $leg[] = $row[0]; 
    }
    As i am using access, i made the tables in access and i'm trying to convert the codes so that it's not using mysql, instead i want it to be the access equilivant.

  5. #5
    Join Date
    Jul 2004
    Posts
    12
    the code in the previous reply came from an example and the entire code is

    Code:
    <?php 
    include ("c:/jpgraph-1.12.2/src/jpgraph.php");    
    include ("c:/jpgraph-1.12.2/src/jpgraph_bar.php"); 
    
    $db = mysql_connect("localhost", "root","") or die(mysql_error()); 
    
    mysql_select_db("test",$db) or die(mysql_error()); 
    
    $sql = mysql_query("SELECT * FROM students") die(mysql_error()); 
    
    while($row = mysql_fetch_array($sql)) 
    { 
    $data[] = $row[1]; 
    $leg[] = $row[0]; 
    } 
    
    $graph = new Graph(250,150,"auto"); 
    $graph->SetScale("textint"); 
    $graph->img->SetMargin(50,30,50,50); 
    $graph->AdjBackgroundImage(0.4,0.7,-1); //setting BG type 
    $graph->SetBackgroundImage("linux_pez.png",BGIMG_FILLFRAME); //adding image 
    $graph->SetShadow(); 
    
    $graph->xaxis->SetTickLabels($leg); 
    
    $bplot = new BarPlot($data); 
    $bplot->SetFillColor("lightgreen"); // Fill color 
    $bplot->value->Show(); 
    $bplot->value->SetFont(FF_ARIAL,FS_BOLD); 
    $bplot->value->SetAngle(45); 
    $bplot->value->SetColor("black","navy"); 
    
    $graph->Add($bplot); 
    $graph->Stroke(); ?>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •