jasraj Posted August 14, 2009 Share Posted August 14, 2009 Hey, i keep getting the following error, i'm not to sure why. Link to comment https://forums.phpfreaks.com/topic/170189-solved-warning-mysql_fetch_assoc/ Share on other sites More sharing options...
HoTDaWg Posted August 14, 2009 Share Posted August 14, 2009 paste us a copy of your code, fool. Link to comment https://forums.phpfreaks.com/topic/170189-solved-warning-mysql_fetch_assoc/#findComment-897746 Share on other sites More sharing options...
jasraj Posted August 14, 2009 Author Share Posted August 14, 2009 the error is.... Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/gj719/public_html/gigbookers/customer/update.php on line 23 <?php session_start(); include('../library/connectdb.php'); include('../library/selectdb.php'); if ($_SESSION['admin_logged_in']!=true){ header('Location: ../login/login.php'); exit; } $customerid = $_GET['id']; $result = "SELECT * FROM customers LEFT JOIN cardholder ON customers.card_id=cardholder.card_id LEFT JOIN gb_login ON customers.customer_id=gb_login.customer_id WHERE customer_id = $customerid"; $result = mysql_query ( $result ); $row = mysql_fetch_assoc ( $result ); $current_forname = $row['forename']; $current_surname = $row['surname']; $current_address = $row['customeraddress']; $current_phone = $row['customerphone']; ?> <!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" xml:lang="en" lang="en"> <head> <title>Gig Bookers</title> <link rel="stylesheet" type="text/css" href="../library/style.css"/> </head> <body> <div id="wrap"> <div id="header"> <h1><a href="#">Gig Bookers Admin</a></h1> <h2>Online Event Ticket Booking</h2> </div> <!-- End Header --> <div id="top"></div><!-- End Top --> <div id="menu"> <?php include("../admin/naviagation.php") ?> </div> <!-- End Menu --> <div id="content"> <div class="left"> <form method="post" action="update2.php?id=<?php echo $customerid ?>"> <table> <tr> <th>Forename:</th> <td><input name = "forename" value = "<?php echo $current_forname ?>" type="text"/></td> <tr/> <tr> <th>Surename:</th> <td><input name = "surname" value = "<?php echo $current_surname ?>" type="text"/></td> <tr/> <tr> <th>Address:</th> <td><input name = "surname" value = "<?php echo $current_address ?>" type="text"/></td> <tr/> <tr> <th>Phone:</th> <td><input name = "surname" value = "<?php echo $current_phone ?>" type="text"/></td> <tr/> </table> <input type="submit" name="submit" value="Update Customer" /> </form> </div> <!-- End Left --> <div class="right"> <?php include("../admin/rightside.php") ?> </div> <!-- End Right --> <div style="clear: both;"></div><!-- End Clear --> </div> <!-- End --> <div id="bottom"></div> <!-- End Bottem --> <div id="footer"> <p>Designed by Jasraj Gill</p> </div> <!-- End Footer --> </div> <!-- End Wrap / All Div Tags --> </body> </html> Link to comment https://forums.phpfreaks.com/topic/170189-solved-warning-mysql_fetch_assoc/#findComment-897747 Share on other sites More sharing options...
Philip Posted August 14, 2009 Share Posted August 14, 2009 Its because your query failed. echo mysql_error() to see why. Link to comment https://forums.phpfreaks.com/topic/170189-solved-warning-mysql_fetch_assoc/#findComment-897751 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.