Click here to Skip to main content
12,996,709 members (78,097 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi PHP Developers..
I wanted to retrieve data from table called enquiry.
and in 1st page by name userform.php i have below code with $refno = ""; defined at the top of the page with in php tag:

<form name="form1" method="post" action="fetchdata.php">
        <table width="auto" border="0" cellpadding="3" cellspacing="1" align="center" bgcolor="#FFFFFF">
            <td width="78">Ticket No.</td>
            <td width="6">:</td>
            <td width="78" class="float_left">
            <input name="refno" type="text" value="<?php echo $refno; ?>"/></td>
        <input type='submit' value="Submit">

and i have fetchdata.php page where i wanted to retrieve data and display in a table format so i did code as below:
        $dbhost = "localhost";
        $dbuser = "root";
        $dbpass = "";
        $conn = mysql_connect($dbhost, $dbuser, $dbpass);
        $refno = "";
        if(! $conn )
        die('Could not connect: ' . mysql_error());
        $strquery = "select * from enquiry where refno='$refno'";
        $result = mysql_query($strquery);
            <th>Results for Refno entry</th>
        while($data = mysql_fetch_array($result))
            $refno = $data["refno"];
            $date = $data["date"];
            $agentname = $data["agentname"];
            $zcno = $data["zcno"];
            $callerid = $data["callerid"];

            <td><?php echo $refno; ?></td>
            <td><?php echo $date; ?></td>
            <td><?php echo $agentname; ?></td>
            <td><?php echo $zcno; ?></td>
            <td><?php echo $callerid; ?></td>
        echo("</table><br /><br />");

and i am getting error as:
Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in C:\xampp\htdocs\newcrm\fetchdata.php on line 99
refno date agentname zcno callerid

Please request you to help me getting code for retrieving data and it would be very helpful if i get code in simple form as i think i have did in very complex form.

Thanks in advance and happy to be a part of this forum as i get good help and also others questions help me grow from this forum.
Posted 28-Mar-13 21:44pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170609.2 | Last Updated 29 Mar 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100