Jump to content

[SOLVED] Embarassed to even ask


elentz

Recommended Posts

I am trying to set up a simple output to my screen the results from a query.  The query will get infor from a Mysql DB from several tables.  That part I have worked out.  The embarassing part is that I want to take each field I get from the query and echo or print it to the screen.  Eventually I want to take this information and apply it to FPDF and make a PDF out of it.  Tight now I am stumped on getting the info to a page to make sure I am extracting the info.  Here is what I have so far:

//******************************************************
<?php
// Connection to the Database
//******************************************************

      $conn = mysql_connect("localhost", "admin", "xxxxxxxxx");
      mysql_select_db ('vtigercrm50',$conn);

//******************************************************
//******Query to get the ticket information*************
$sql = 'SELECT'
        . ' `vtiger_troubletickets`.`ticketid`,'
        . ' `vtiger_ticketcf`.`cf_534`,'
        . ' `vtiger_ticketcf`.`cf_536`,'
        . ' `vtiger_ticketcf`.`cf_538`,'
        . ' `vtiger_ticketcf`.`cf_540`,'
        . ' `vtiger_troubletickets`.`title`,'
        . ' `vtiger_troubletickets`.`description`,'
        . ' `vtiger_troubletickets`.`parent_id`,'
        . ' `vtiger_account`.`accountid`,'
        . ' `vtiger_accountshipads`.`ship_city`,'
        . ' `vtiger_accountshipads`.`ship_street`,'
        . ' `vtiger_accountshipads`.`ship_code`,'
        . ' `vtiger_accountshipads`.`ship_state`,'
        . ' `vtiger_account`.`phone`,'
        . ' `vtiger_accountscf`.`cf_472`,'
        . ' `vtiger_accountscf`.`cf_476`,'
        . ' `vtiger_accountscf`.`cf_464`,'
        . ' `vtiger_accountscf`.`cf_478`,'
        . ' `vtiger_accountscf`.`cf_484`,'
        . ' `vtiger_accountscf`.`cf_486`,'
        . ' `vtiger_accountscf`.`cf_468`'
        . ' FROM'
        . ' `vtiger_troubletickets`'
        . ' Inner Join `vtiger_ticketcf` ON `vtiger_troubletickets`.`ticketid` = `vtiger_ticketcf`.`ticketid`'
        . ' Inner Join `vtiger_account` ON `vtiger_troubletickets`.`parent_id` = `vtiger_account`.`accountid`'
        . ' Inner Join `vtiger_accountshipads` ON `vtiger_account`.`accountid` = `vtiger_accountshipads`.`accountaddressid`'
        . ' Inner Join `vtiger_accountscf` ON `vtiger_account`.`accountid` = `vtiger_accountscf`.`accountid`
Where 'vtiger_troubletickets'.'ticketid' = '17271'';

//************End Query****************

$result=mysql_query($sql);
$title = mysql_result(title);

echo $title;
?>

 

Thanks for any suggestions anyone might have

Link to comment
https://forums.phpfreaks.com/topic/80767-solved-embarassed-to-even-ask/
Share on other sites

Better to use mysql_fetch_assoc then mysql_result:

$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);

echo '<pre>' . print_r($row, true) . '</pre>';

 

$row will be an associative array. I use print_r above to display the contents of the $row array.

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.