| | |
php warning fetching a record from database
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Jul 2008
Posts: 13
Reputation:
Solved Threads: 0
hi ,
PHP Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\Domains\eazygurus.com\wwwroot\courses.php on line 45
im getting this error please help me out from this. im attaching the php file and copying my database values........
Table structure for table `course`
--
PHP Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\Domains\eazygurus.com\wwwroot\courses.php on line 45
im getting this error please help me out from this. im attaching the php file and copying my database values........
Table structure for table `course`
--
sql Syntax (Toggle Plain Text)
CREATE TABLE `course` ( `id` INT(50) NOT NULL AUTO_INCREMENT, `course` VARCHAR(50) NOT NULL, `subcourse` VARCHAR(50) NOT NULL, `fee` INT(50) NOT NULL, `content` VARCHAR(1000) NOT NULL, `DATE` TEXT NOT NULL, PRIMARY KEY (`id`) ) ENGINE=INNODB DEFAULT CHARSET=latin1 AUTO_INCREMENT=34 ; -- -- Dumping data for table `course` -- INSERT INTO `course` (`id`, `course`, `subcourse`, `fee`, `content`, `DATE`) VALUES (24, 'java', 'dddddddddddsssssssss', 212121, '11111111111111111111111', '2008-08-29');
Last edited by peter_budo; Sep 10th, 2008 at 3:43 pm. Reason: Keep It Organized - please use [code] tags
•
•
Join Date: Jul 2008
Posts: 19
Reputation:
Solved Threads: 3
When you go to "courses.php" for the FIRST TIME, do you have a query after the .php ?
Something like:
.../courses.php?course=course_name&subcourse=something
Something like:
.../courses.php?course=course_name&subcourse=something
// courses & subcourse values are mandatory as programmed with: $course=$_GET['course'] $subcourse= $_GET['subcourse'];
Last edited by NormandP; Sep 10th, 2008 at 9:52 am. Reason: ameliorate
this line should be like this:
php Syntax (Toggle Plain Text)
$query=("select * from course where course='".$course."'") or die(mysql_error());
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
•
•
Join Date: Jul 2008
Posts: 41
Reputation:
Solved Threads: 7
Hi Shanthi..
here the total code working properly...
the problem arises when i write where condition......
here
This is the part of the code where i m getting an error.
Error:mysql_fetch_array(); supplied arguement is not a valid mysql resource.
here the total code working properly...
the problem arises when i write where condition......
here
PHP Syntax (Toggle Plain Text)
$course=$_GET['course']; $query=("select * from course where course='".$course."' ) or die(mysql_error()); while($result=mysql_fetch_array($query)) { }
This is the part of the code where i m getting an error.
Error:mysql_fetch_array(); supplied arguement is not a valid mysql resource.
With Regards,
Kishore
Kishore
hello kishor..
echo this line and tel me wat u got:
echo $course=$_GET['course'];
and also echo this statement:
echo this line and tel me wat u got:
echo $course=$_GET['course'];
and also echo this statement:
php Syntax (Toggle Plain Text)
echo $r="select * from course where course='".$course."'";
Last edited by Shanti Chepuru; Sep 11th, 2008 at 7:26 am.
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
•
•
Join Date: Jul 2006
Posts: 197
Reputation:
Solved Threads: 5
try this
PHP Syntax (Toggle Plain Text)
echo $r="select * from course where course=$course;
Thanks
VSSP
VSSP
•
•
Join Date: Jul 2008
Posts: 41
Reputation:
Solved Threads: 7
PHP Syntax (Toggle Plain Text)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="description" content="Small Corporation" /> <meta name="keywords" content="small, corporation" /> <link rel="stylesheet" href="style.css" type="text/css" /> <style type="text/css"> <!-- .style4 {color: #FFFFFF} .style5 {color: #2D5181} --> </style> </head> <body> <div id="contentcourse"> <div id="header"></div> <ul id="menu"> <li><a class="current" href="index.php">Home</a></li> <li><a href="aboutus.php">About Us</a></li> <li><a href="courses.php">Courses</a></li> <li><a href="demo_registration.php">Demo Class Registration</a></li> <li><a href="faq.php">FAQ's</a></li> <li><a href="order.php">How To Order</a></li> <li><a href="payment.php">Payment Options</a></li> <li><a href="enquiry.php">Enquiry</a></li> <li><a href="contact.php">Contact Us</a></li> </ul> <div id="course"> <div id="title"> <h3>Sub Courses</h3> </div> <br/> <?php include("config.php"); $course=$_GET['course']; $query=("select course,subcourse from course WHERE course=$course") or die(mysql_error()); $ress1=mysql_query($query); while($rows=mysql_fetch_array($ress1)) { $subcourse= $rows['subcourse']; ?> <font color="#666666"> <a href="courses.php?course=<?php echo $course ;?>&subcourse=<?php echo $subcourse ;?>" > <?php echo $subcourse; echo "<br>"; ?> </a></font> <?php }?> <?php $course=$_GET['course']; $subcourse= $_GET['subcourse']; $ress2=mysql_query("select * from course where subcourse='$subcourse'") or die(mysql_error()); while($rows=mysql_fetch_array($ress2)) { $subcourse= $rows['subcourse']; $fee= $rows['fee']; $content= $rows['content']; ?><br /> <table width="85%" border="1" bordercolor="#CCCCCC"> <tr > <td width="14%" height="40" ><strong>Course:</strong></td> <td width="86%" ><?php echo $subcourse; ?></td> </tr> <tr> <td height="39"><strong>Fee:</strong></td> <td><?php echo $fee; ?></td> </tr> <tr> <td height="210"><strong>Discription:</strong></td> <td><textarea rows="13" cols="50"><?php echo $content; ?></textarea> </td> </tr> </table> <?php } ?> <p> </p> </div> <div id="title1"> <h3 class="style5">Courses Offered</h3> </div> <div id="sidemenu"> <p> <?php $ress=mysql_query("select DISTINCT course from course ") or die(mysql_error()); while ($row = mysql_fetch_array($ress)) { $course= $row['course']; ?> <a href="courses.php?course='<?php echo $course ;?>'" > <?php echo $row['course']; echo "<br>"; }?> </a> </p> </div> <div id="footer"><br/> <div align="center"><span class="links"><a href="index.php">Home</a> <a href="aboutus.php">About Us</a> <a href="courses.php">Courses</a> <a href="demo_registration.php">Demo Class Registration</a> <a href="faq.php">FAQ's</a> <a href="order.php">How To Order</a> <a href="payment.php">Payment Options</a> <a href="enquiry.php">Enquiry</a> <a href="contact.php">Contact Us</a></span></div> </div> </div> </body> </html>
this is the original code what we did with out making anychanges u asked us to make.
Database has been posted in the first post of the thread..
With Regards,
Kishore
Kishore
![]() |
Other Threads in the PHP Forum
- Previous Thread: how to php error handling...
- Next Thread: about e-shopping
| Thread Tools | Search this Thread |
ajax apache api array basics beginner binary bounce broken cakephp checkbox class cms code codingproblem combobox cron curl database date display dynamic echo email error file files folder form format forms function functions google href htaccess html image include insert interactive ip javascript joomla js limit link login mail malfunctioning menu mlm mobile multiple mysql nodes oop outofmemmory paging parse paypal pdf php problem procedure query radio ram random recursion reference regex remote return script search server sessions sms soap source space sql syntax system table tutorial up-to-date update upload url validation validator variable video web webapplications websitecontactform xml youtube






