Jump to content

Ravi Kumar

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Ravi Kumar's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. In PHP user document it is written tht we can use either mysql_fetch_array($query_results,MYSQL_NUM); or mysql_fectch_array($query_results,MYSQL_ASSOC); in this case if we want to write code like [code]     echo "<tr>";     echo "<th>Character Name:</th> <td>".$result['name'] . "</td></tr>";     echo "<th>HP:</th> <td>".$result['mp'] . " </td></tr>";     echo "<th>MP:</th> <td>" . $result['mp'] . " </td></tr>";     echo "<th>EXP:</th> <td>" . $result['exp'] . " </td></tr>";     echo "<th>SP:</th> <td>" . $result['sp'] . " </td></tr>";     echo "</table>"; } [/code] we need to use while($result=mysql_fetch_array($query_results,MYSQL_ASSOC)). This is working fine in my application.
  2. sorry for the copy-paste error. [code] <?php $query="SELECT * FROM `table` WHERE `column` = 'value' "; // Change to your own MySQL code $query_results=mysql_query($query); while($result=mysql_fetch_array($query_results,MYSQL_NUM)){     echo "<table>";     echo "<tr>";     echo "<th>Character Name:</th> <td>".$result['name'] . "</td></tr>";     echo "<th>HP:</th> <td>".$result['mp'] . " </td></tr>";     echo "<th>MP:</th> <td>" . $result['mp'] . " </td></tr>";     echo "<th>EXP:</th> <td>" . $result['exp'] . " </td></tr>";     echo "<th>SP:</th> <td>" . $result['sp'] . " </td></tr>";     echo "</table>"; } ?> [/code] the difference of my previous post and this post is "MYSQL_NUM" in inside mysql_fectch_array(). This is working for me!. I am using this in my application.
  3. try the following.It should work. [code] <?php $query="SELECT * FROM `table` WHERE `column` = 'value' "; // Change to your own MySQL code $query_results=mysql_query($query); while($result=mysql_fetch_array($query_results),MYSQL_NUM){     echo "<table>";     echo "<tr>";     echo "<th>Character Name:</th> <td>".$result['name'] . "</td></tr>";     echo "<th>HP:</th> <td>".$result['mp'] . " </td></tr>";     echo "<th>MP:</th> <td>" . $result['mp'] . " </td></tr>";     echo "<th>EXP:</th> <td>" . $result['exp'] . " </td></tr>";     echo "<th>SP:</th> <td>" . $result['sp'] . " </td></tr>";     echo "</table>"; } ?> [/code]
  4. HI All I am facing the same problem. Form my PHP code I am able to send mail to some domains except yahoo,gmail and etc....... I searched in the forum and found a few threads.But none of them has final solution. please find the below code. [code] <?php ini_set("display_errors", "1"); ini_set("error_reporting", "E_ALL"); $headers  = "From: "    . "ravi.kotha@domain.com" . "\n"; $headers .= "Reply-To: " . "ravi.kotha@domain.com". "\n"; $headers .= "Cc: "      . "ravi_1201@yahoo.com"  . "\n"; $headers .= "Bcc: "      . "ravikumar.kotha@gmail.com"  . "\n"; $message = "message content"; $subject = "working on mailing functionality"; $to      = "ravi.kotha@domain.com,anantharavi@yahoo.co.in"; $flag    = mail($to,$subject,$message,$headers); print "flag is $flag"; ?> [/code] Please let me know the solution. Appreciate your help. thanks Ravi Kumar
  5. Hi All Here is my problem. I have PHP 5 and MYSQL 4.1 installed on my server machine. Now we want to upgrade to mysql 5.For this we have installed MySql 5.0 on one of our machines and using this machine's ip address to connect to MySql. Our application is behaving strangely. It is pulling information from mysql 4 database in some pages which it shouldn't and in other pages it is pulling information from mysql 5 database though the ipaddress of the DBHOST is pointed to MYSQL 5. We have cross checked all the configuration files and $DBHOST variable in connection class. Please go through the below code snippet class samplebl {         private $conn;         function __construct()         { $this->conn = DbFactory::getWriter(); } function __destruct() { DbFactory::close($this->conn); }         function getData()         {               //this is supposed to pull data from 172.16.*.*               $result = mysql_query("select * from products");         } } class DbFactory {         public static function getReader() {                 //dbhost is pointing to mysql 5.0 on following address.Mysql 4 is on same machine. return self::connect('172.16.*.*', 'root', ''); } public static function getWriter() { return self::connect('172.16.*.*', 'root', ''); } private static function connect($dbHost, $dbLogin, $dbPassw) { $conn = mysql_connect($dbHost, $dbLogin, $dbPassw); if (!$conn) {   die('Could not connect: ' . mysql_error()); $conn = false; } else { ; } return $conn; } public static function close($conn) { if ($conn) { mysql_close($conn); } } } Please help me on this. Waiting for a response.... Ravi Kumar
×
×
  • 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.