PHP - Mysql_fetch_array(): Supplied Argument Is Not A Valid...
I have searched for this topic here but have not found reference to it.
I am receiving the following: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a4542527/public_html/index.php on line 8 The scripting for this is basic at this point (I am building something in steps and this is just a test section: The script will call data from the table and display said data.) The following is the code (two, separate files located on my server)- I am hoping that someone may see something that I am missing. connection.php <?php $dbhost = 'mysql7.000webhost.com'; $dbuser = 'a4542527_root'; $dbpass = '**********'; $db = 'a4542527_test1'; $conn = mysql_connect($dbhost,$dbuser,$dbpass); mysql_select_db($db); ?> index.php <?php include 'connection.php'; $query = "SELECT * FROM people"; $result = "mysql_query($query)"; while ($person = mysql_fetch_array($result)){ echo $person ['name']; echo $person ['descrip']; } ?> Thank-you for any help, suggestions or a point in the right direction. ~Matty Similar TutorialsHi everyone!! I finish to do my second populating drop down list. it's not realy the display I was looking but for now it will be good. but when I click on my serach button I receive this erro. Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\scale24-25\search-keyword.php on line 112 this is what line 112 is in the search file. //-create while loop and loop through result set while($row=mysql_fetch_array($result)){ <-------------- line 112 here's the code of my form... <?php include_once("connection.php"); ////////////////////////////// ?> <!doctype html public "-//w3c//dtd html 3.2//en"> <html> <head> <title>1/24 - 1/25 scale model database</title> <SCRIPT language=JavaScript> function reload(form) { var val=form.cat.options[form.cat.options.selectedIndex].value; self.location='search-db-foreach.php?cat=' + val ; } </script> </head> <body > <img src="http://www.scale24-25.com/images/banners/banner.jpg" alt="banner" width="997" height="213" border="0" usemap="#Map" /> <map name="Map" id="Map"> <area shape="poly" coords="0,100,85,102,92,55,108,50,326,51,323,7,3,3" href="http://www.hobby-shop.qc.ca" alt="hobby-shop" /> <area shape="poly" coords="672,57,891,53,887,4,995,4,985,108,673,102" href="http://www.hobby-shop.qc.ca" alt="hobby-shop" /> <area shape="poly" coords="326,13,330,53,98,54,90,92,670,99,668,54,889,51,886,5" href="http://www.scale-auto-style.com" alt="" /> </map> <?php if (isset($_POST['todo']) && $_POST['todo'] == "search") { $todo=$_POST['todo']; $manufacturer_reel=$_POST['manufacturer_reel']; $query="select * from kit where "; ////////// Including manufacturer_reel field search //// if(strlen($manufacturer_reel) > 0 ){ $query.= " manufacturer_reel='$manufacturer_reel' and "; } //// End of class field search /////////// $query=substr($query,0,(strLen($query)-4)); echo $query; echo "<br><br>"; $nt=mysql_query($query); echo mysql_error(); // End if form submitted }else{ echo "<form method=post action='search-keyword.php?go'><input type=hidden name=todo value=search>"; ?> <table width="960" border="0"> <tr> <td colspan="3"><table width="100%" border="0"> <tr> </tr> <tr> <td><div align="right"></div></td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td><div align="right">Echelle du modele</div></td> <td align="center"> <?php // strat of drop down /// $q=mysql_query("SELECT DISTINCT scale FROM kit ORDER BY scale"); echo '<select name="scale"><option value="scale">Please Choose an Option</option>'; while($row = mysql_fetch_array($q)) { $thing = $row['scale']; echo '<option>'.$thing.'</option>'; } echo "</select>"; echo " <br> \n"; echo " <br> \n"; ?></td> <td><div align="left">Scale of model</div></td> </tr> <tr> <td> </td> <td> </td> <td><div align="right"></div></td> </tr> <tr> <td><div align="right">Nom du manufacturier automobile</div></td> <td align="center"><?php // strat of drop down /// /* If register_global is off in your server then after reloading of the page to get the value of cat from query string we have to take special care. @$cat=$_GET['cat']; // Use this line or below line if register_global is off if(strlen($cat) > 0 and !is_numeric($cat)){ // to check if $cat is numeric data or not. echo "Data Error"; exit; } */ @$cat=$HTTP_GET_VARS['cat']; // Use this line or above line if register_global is off ///////// Getting the data from Mysql table for first list box////////// $quer2=mysql_query("SELECT DISTINCT manufacturer_reel,manufacturer_reel_id FROM kit order by manufacturer_reel"); ///////////// End of query for first list box//////////// /////// for second drop down list we will check if manufacturer_reel is selected else we will display all the car_model///// if(isset($cat) and strlen($cat) > 0){ $quer=mysql_query("SELECT DISTINCT car_model FROM kit where manufacturer_reel_id=$cat order by car_model"); }else{$quer=mysql_query("SELECT DISTINCT car_model FROM kit order by car_model"); } ////////// end of query for second car_model drop down list box /////////////////////////// ////////// Starting of first drop downlist ///////// echo "<select name='cat' onchange=\"reload(this.form)\"><option value=''>Select one</option>"; while($noticia2 = mysql_fetch_array($quer2)) { if($noticia2['manufacturer_reel_id']==@$cat){echo "<option selected value='$noticia2[manufacturer_reel_id]'>$noticia2[manufacturer_reel]</option>"."<BR>";} else{echo "<option value='$noticia2[manufacturer_reel_id]'>$noticia2[manufacturer_reel]</option>";} } echo "</select>"; ////////////////// This will end the first drop down list /////////// ////////// Starting of second drop downlist ///////// echo "<select name='subcat'><option value=''>Select one</option>"; while($noticia = mysql_fetch_array($quer)) { echo "<option value='$noticia[car_model]'>$noticia[car_model]</option>"; } echo "</select>"; // end of drop down /// echo " <br> \n"; echo " <br> \n"; // end of drop down /// ?></td> <td><div align="left">Name Of vehicule manufacturer</div></td> </tr> <tr> <td> </td> <td> </td> <td><div align="right"></div></td> </tr> <tr> <td><div align="right">Nom du manufacturier de modele reduit</div></td> <td align="center"><?php // start of drop down /// $q=mysql_query("SELECT DISTINCT manufacturer_kit FROM kit ORDER BY manufacturer_kit"); echo '<select name="manufacturer_kit"><option value="kit manufacturer">Please Choose an Option</option>'; while($row = mysql_fetch_array($q)) { $thing = $row['manufacturer_kit']; echo '<option>'.$thing.'</option>'; } echo "</select>"; // end of drop down /// echo " <br> \n"; echo " <br> \n"; ?></td> <td><div align="left">Name Of kit manufacturer</div></td> </tr> <tr> <td><div align="right"></div></td> <td> </td> <td> </td> </tr> <tr> <td><div align="right">Annee de fabrication du Vehicule</div></td> <td align="center"><?php // strat of drop down /// $q=mysql_query("SELECT DISTINCT year_prod_reel FROM kit ORDER BY year_prod_reel"); echo '<select name="year_prod_reel"><option value="vehicules year manufactured">Please Choose an Option</option>'; while($row = mysql_fetch_array($q)) { $thing = $row['year_prod_reel']; echo '<option>'.$thing.'</option>'; } echo "</select>"; // end of drop down /// echo " <br> \n"; echo " <br> \n"; ?></td> <td><div align="left">Year of production of the vehicule</div></td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td align="center"> </td> <td> </td> </tr> <tr> <td><div align="right"><strong></strong></div></td> <td align="center"> <?php echo " <br><input type=submit value=Search name='name' action='search-keyword.php?go' > </form> "; } ?> <td><div align="left"><strong></strong></div></td> </table> </body> </html> and this the search file <?php include_once("connection.php"); ////////////////////////////// ?> <!doctype html public "-//w3c//dtd html 3.2//en"> <html> <head> <title>(Type a title for your page here)</title> </head> <body > <p align="center"><img src="http://www.scale24-25.com/catalog/images/banners/banner.jpg" alt="banner" width="997" height="213" border="0" usemap="#Map" /> <map name="Map" id="Map"> <area shape="poly" coords="0,100,85,102,92,55,108,50,326,51,323,7,3,3" href="http://www.hobby-shop.qc.ca" alt="hobby-shop" /> <area shape="poly" coords="672,57,891,53,887,4,995,4,985,108,673,102" href="http://www.hobby-shop.qc.ca" alt="hobby-shop" /> <area shape="poly" coords="326,13,330,53,98,54,90,92,670,99,668,54,889,51,886,5" href="http://www.scale-auto-style.com" alt="" /> </map></p> <table width="920" border="0"> <tr> <td width="359"><p class="style5">You will find some TBC. TBC is for "To Be Confirmed". If somebody know the missing information ( TBC ) it will be appreciate to send it to me at this mail: <a href="mailto:info@hobby-shop.qc.ca">info@hobby-shop.qc.ca</a> <br /> <br /> thanks in advance for your help</p> </td> <td width="161"><div align="center"><a href="search-db-foreach.php"><img src="catalog/images/design_web/othersearch.jpg" border="0" alt="search" width="150" height="96"></a></div></td> <td width="386"> <div align="right"> <p>This logo <img src= 'http://www.scale24-25.com/images/PDF_logo.gif' width='50' height='50'/> mean that you can download a PDF file. To read it you need minimum Acrobat reader and you can download it <a href="http://get.adobe.com/reader/">here</a></p> <p>Some link will return a TBC. Sorry for any inconveniant. as soon as we will receive or do the PDF it will be updated.</p> </div></td> </tr> </table> <br> <?php if (isset($_POST['todo']) && $_POST['todo'] == "search") { $todo=$_POST['todo']; $name=$_POST['cat']; $name1=$_POST['manufacturer_kit']; $name2=$_POST['year_prod_reel']; $name3=$_POST['scale']; $name11=$_POST['subcat']; //-query the database table for the post field $sql="SELECT kit_id, kit_number, kit_name, description_eng, description_fr, manufacturer_kit, manufacturer_reel, manufacturer_reel_id, scale, engine_detail, year_prod_kit, year_prod_reel, image_id, image_id1, image_id2 FROM kit "; $sqlOperand="WHERE"; if ($name != "cat") { $sql = $sql . $sqlOperand . " cat LIKE '%" . $name ."%' "; $sqlOperand = " AND "; } if ($name1 != "kit manufacturer") { $sql = $sql . $sqlOperand . " manufacturer_kit LIKE '%" . $name1 ."%' "; $sqlOperand = " AND "; } if ($name11 != "subcat") { $sql = $sql . $sqlOperand . " subcat LIKE '%" . $name11 ."%' "; $sqlOperand = " AND "; } if ($name2 != "vehicules year manufactured") { $sql = $sql . $sqlOperand . " year_prod_reel LIKE '%" . $name2 ."%' "; $sqlOperand = " AND "; } if ($name3 != "scale") { $sql = $sql . $sqlOperand . " scale LIKE '%" . $name3 ."%' "; $sqlOperand = " AND "; } if ($sqlOperand == "WHERE") { echo "<p>Please enter a search query</p>"; } else { // echo '<img src="web-design/sorry.jpg" alt="sorry">'; // echo "Sorry nothing match your selection / Desolle rien ne correspond a votre selection"; // echo "run sql: <BR> $sql <BR> and display results"; } //-run the query against the mysql query function $result=mysql_query($sql); //-make the header of the table echo " <table align=center width=\"1340\" border=\"\">\n"; echo " <tr>\n"; echo" <td nowrap align=center width='95'> kit manufacturer \n"; echo" <td nowrap align=center width='55'> scale \n"; echo" <td nowrap align=center width='90'> kit number \n"; echo" <td nowrap align=center width='290'> kit name \n"; echo" <td nowrap align=center width='400'> description \n"; echo" <td nowrap align=center width='125'> vehicule year \n"; echo" <td nowrap align=center width='80'> complete engine detail\n"; echo" <td nowrap align=center width='80'> Select Picture to get bigger\n"; echo" <td nowrap align=center width='75'> instruction sheet\n"; echo" <td nowrap align=center width='75'> box contain\n"; echo " <tr>\n"; //-create while loop and loop through result set while($row=mysql_fetch_array($result)){ $description_eng =$row['description_eng']; $manufacturer_kit=$row['manufacturer_kit']; $scale=$row['scale']; $manufacturer_reel=$row['manufacturer_reel']; $kit_id=$row['kit_id']; $kit_number=$row['kit_number']; $kit_name=$row['kit_name']; $engine_detail=$row['engine_detail']; $year_prod_reel=$row['year_prod_reel']; $image_id=$row['image_id']; $image_id1=$row['image_id1']; $image_id2=$row['image_id2']; //-create table of item during he while loop echo " <table align=center width=\"1340\" border=\"\">\n"; echo" <td nowrap align=center width='95'> $manufacturer_kit \n"; echo" <td nowrap align=center width='55'> $scale \n"; echo" <td nowrap align=center width='90'> $kit_number \n"; echo" <td nowrap align=center width='290'> $kit_name \n"; echo" <td nowrap width='400'> $description_eng \n"; echo" <td nowrap align=center width='125'> $year_prod_reel \n"; echo" <td nowrap align=center width='80'> $engine_detail \n"; echo" <td nowrap width='80'> <a href=".$image_id."> <img src='".$image_id."' width='75' height='50' border='0'/>"; echo" <td nowrap width='75'> <a href= ".$image_id1."> <img src= 'http://www.scale24-25.com/images/PDF_logo.gif' width='50' height='50' border='0'/>"; echo" <td nowrap width='75'> <a href=".$image_id2."> <img src='http://www.scale24-25.com/images/PDF_logo.gif' width='50' height='50' border='0'/>"; echo " </tr>\n"; echo " </table>\n"; echo " </tr>\n"; echo " </table>\n"; } } else{ echo "<p>Please enter a search query</p>"; } ?> </body> </html> so what I do wrong. I knowI forgot something but what???? thanks in advance for your help sebastien I am getting an error message. Quote mysql_fetch_array(): supplied argument is not a valid MySQL result My Sql seems to work fine. But I kept on getting this error message whenever I try to view orderid. I have option to view different field such as orderid, orderdate, price and profit. When the page loads its fine. But when I try to view orderdate the orderid I get the error message Error code is on the first line and the other places where it says $result. Code: [Select] while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td align='left'>" . $row['orderid'] . "</td>"; echo "<td align='left' style='font-size:12px;'>" . $row['orderdate'] . "</td>"; echo "<td align='left' style='font-size:12px;'>" . $row['updated'] . "</td>"; echo "<td align='left' style='font-size:12px;'>" . $row['name'] . "</td>"; echo "<td align='left' style='font-size:12px;'>" . $row['price'] . "</td>"; echo "<td align='left'>" . $row['salesman'] . "</td>"; echo "<td align='left'>" . $row['origsalesman'] . "</td>"; echo "<td align='left'>" . $row['status'] . "</td>"; echo "<td align='left'>" . $row['product'] . "</td>"; echo "<td align='left'>£" . $row['profit'] . "</td>"; echo "</tr>"; echo "<tr><td colspan='10'><hr></td></tr>"; } if ( mysql_num_rows( $result ) == 0 ) echo "<tr><td colspan='10'>No orders found<hr></td></tr>"; echo "</table></form>"; mysql_free_result( $result );code] Please help me. Hi Guys, I have been working on a recursive select box that will allow sub-categories and keep getting the error: <b>Warning</b>: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in <b>test.php</b> on line <b>22</b><br / i have a table as follows: Code: [Select] CREATE TABLE IF NOT EXISTS `ost_help_topic` ( `topic_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `isactive` tinyint(1) unsigned NOT NULL DEFAULT '1', `noautoresp` tinyint(3) unsigned NOT NULL DEFAULT '0', `priority_id` tinyint(3) unsigned NOT NULL DEFAULT '0', `dept_id` tinyint(3) unsigned NOT NULL DEFAULT '0', `CatParent` bigint(11) unsigned DEFAULT NULL, `topic` varchar(32) NOT NULL DEFAULT '', `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`topic_id`), UNIQUE KEY `topic` (`topic`), KEY `priority_id` (`priority_id`), KEY `dept_id` (`dept_id`) ) Code: [Select] <?php $db_host = "localhost"; $db_un = "user"; $db_pass = "pass"; $Item_DB = "data"; $table = "ost_help_topic"; $link = mysql_connect($db_host, $db_un, $db_pass); $tab = " "; // this is 8 spaces, which works as a pseudo-tab character inside the <option>s $tablvl = 1; function print_kids($pos) { // $pos is the current position inside the hierarchy (curr item's ID) global $link; global $tab; global $tablvl; $pos = ($pos?$pos:null); $query = "SELECT * from $table WHERE isactive=1 AND CatParent".($pos == null ? " IS NULL" : "=".$pos); // NULL parent == top level item. For 0-parents, replace " IS NULL" with "=0" $res = mysql_db_query($Item_DB, $query, $link); if (!$res) print(mysql_error()); while($row = mysql_fetch_array($res)) { $has_kids = mysql_fetch_array(mysql_db_query($Item_DB, "SELECT * from $table where isactive=1 AND CatParent=$row[0]", $link)) != null; print("<option value=\"$row[0]\">"); for ($i=0; $i<$tablvl; $i++) print($tab); print("$row[6]</option>\n"); if ($has_kids) { $tablvl++; print_kids($row[0]); // <span class="posthilit">recursive</span> call $tablvl--; } } } $numrows = 1; $res = mysql_db_query($Item_DB, "SELECT * FROM $table", $link); while (mysql_fetch_array($res)) $numrows++; // Yes, I'm sure there's a more efficient way to do this <img src="./images/smilies/icon_razz.gif" alt=":P" title="Razz" /> print("<select name=\"hierarchy\" size=\"$numrows\">\n"); print("<option value=\"null\" selected=\"selected\">Root of all items</option>\n"); print_kids(0); print("</select>"); mysql_close($link); ?> Hi, I am having problem with mysql and php.... when i test the database on my local host it didt produce any error but when i put it on my web host it gave me error messages... "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource" Please help me as i am new to php. Quote <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" type="text/css" href="http://www.hingloong.com/pricesearch/style.css" /> <title>Price Search Query</title> </head> <body> <form method=GET action="search.php"> <div id=container> <select name=general> <option value = all>Select</option> <option value = laptop>Laptop</option> <option value = mobile>Mobile</option> <option value = games>Games</option> <option value = camera>Camera</option> </select> <label><b>Brand:</b></label> <input type=text name=brand> <label><b>Model:</b></label> <input type=text name=model> <input type=submit name=search value=Search> </form> <br><br> <input type=button name=gamelist value=View Games onclick="location.href='gamelist.php'"> <input type=button name=mobilelist value=View Mobile onclick="location.href='mobilelist.php'"> <input type=button name=cameralist value=View Cameras onclick="location.href='cameralist.php'"> <input type=button name=laptoplist value=View Laptops onclick="location.href='laptoplist.php'"> </div> </body> </html> <?php include ("connect.php"); $general = $_GET['general']; $brand = $_GET['brand']; $model = $_GET['model']; if($general == 'mobile') { echo "<br>"; echo "<h3>Mobile Phone Prices</h3>"; echo "<div id=container>"; echo "<table>"; echo "<tr>"; echo "<td class=head>Phone Brand</td>"; echo "<td class=head>Phone Model</td>"; echo "<td class=head>Phone Loan</td>"; echo "<td class=head>Phone Buy</td>"; echo "<td class=head>Phone Sell</td>"; echo "<td class=head>Phone Rrp</td>"; echo "</tr>"; $query = "select * from mobilephones where phone_brand LIKE ('$brand%') AND phone_model LIKE ('$model%') "; $temp = mysql_query($query) or die(mysql_error()); } while ($row = mysql_fetch_array($temp)) { echo "<tr>"; echo "<td>" .$row['phone_brand']. "</td>"; echo "<td>" .$row['phone_model']. "</td>"; echo "<td>" .$row['phone_loan']. "</td>"; echo "<td>" .$row['phone_buy']. "</td>"; echo "<td>" .$row['phone_sell']. "</td>"; echo "<td>" .$row['phone_rrp']. "</td>"; } echo "</table>"; echo "</div>"; ?> I have this search script, that finds a username in a table and displays it. <form name="search" method="post" action="<?=$PHP_SELF?>"> Search: <input type="text" name="username" /> <input type="hidden" name="searching" value="yes" /> <input type="submit" name="search" value="Search" /> </form> <? //This is only displayed if they have submitted the form $searching = $_POST['searching']; $find = $_POST['username']; if ($searching =="yes") { echo "<h2>Results</h2><p>"; //If they did not enter a search term we give them an error if ($find == "") { echo "<p>You forgot to enter a search term"; exit; } // Otherwise we connect to our Database // We preform a bit of filtering $find = strtoupper($find); $find = strip_tags($find); $find = trim ($find); //Now we search for our search term, in the field the user specified $data = mysql_query("SELECT username FROM users WHERE upper($find) LIKE'%$find%'"); //And we display the results while($result = mysql_fetch_array( $data )) { echo $result['username']; echo "<br>"; echo "<br>"; } //This counts the number or results - and if there wasn't any it gives them a little message explaining that $anymatches= mysql_num_rows ($data); if ($anymatches == 0) { echo "Sorry, but we can not find an entry to match your query<br><br>"; } //And we remind them what they searched for echo "<b>Searched For:</b> " .$find; } ?> For some reason it does not work and gives this message: [b]Warning[/b]: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in [b]C:\Program Files\EasyPHP5.2.10\www\yanille\users.php[/b] on line [b]153[/b] Error: Unknown column 'MI' in 'where clause' The reason it says MI is because I searched mi in the database which is part of the username in mike123 What would be the problem? I think I did make the query correct. Didn't I? Thanks for the help ahead of time. Hi, first post, and yes it is a question. I am stuck, and not by choice, this error has given me more headaches than I care to admit. I have a script that I am attempting here, that is very simple for now, all I want to show is the Added_By field to show it is accessing the database correctly and the right row/line all together. The page to test this at is he http://kaboomlabs.com/PDI/@dm!n/viewncmr.php?id=2 The Error is this: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/pawz/public_html/kaboomlabs.com/PDI/@dm!n/viewncmr.php on line 18 This is row 18: $row = mysql_fetch_array($data); Now I know this is not a secure form yet, I am working on getting the basic functions down then I'll secure it, so please let me worry about that when the time comes. Here is the script, can anyone see a blatant issue or not? Thanks in advance. Code: [Select] <?php require_once('../connectvars.php'); // Connect to the database $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); // Grab the profile data from the database if (!isset($_GET['id'])) { $query = "SELECT * FROM ncmr WHERE id = '" . $_SESSION['id'] . "'"; } else { $query = "SELECT * FROM ncmr WHERE id = '" . $_GET['id'] . "'"; $data = mysqli_query($dbc, $query); } if (mysqli_num_rows($data) == 1) { // The user row was found so display the user data $row = mysql_fetch_array($data); echo '<fieldset>'; if (!empty($row['Added_By'])) { echo '<div id ="added"><label>Added By:</label>' . $row['Added_By'] . '</div></fieldset>'; } } // End of check for a single row of user results else { echo '<p class="error">There was a problem accessing your profile.</p>'; } mysqli_close($dbc); ?> Hi guys, for the life of me, what am I doing wrong, I cannot figure out this one, getting this error : Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in ......... search.php on line 36 my code : Code: [Select] $start = ($page-1)*$per_page; $sql = "SELECT productId, productCode, image, name, price, stock_level FROM inventory WHERE productCode LIKE '%".$searchp."%' OR name LIKE '%".$searchp."%' AND Seller_ID = '" . $_SESSION['SESS_SELL_ID'] . "' order by name limit $start,$per_page"; $rsd = mysql_query($sql); <?php while($row = mysql_fetch_array($rsd)) // ERROR OCCURS HERE : line 36 { $idpc=$row['productId']; $idc=$row['productCode']; $idi=$row['image']; $idn=$row['name']; $idp=$row['price']; $ids=$row['stock_level']; ?> all help appreciated as always. In the following code, at the mysql query immediately following the <!--end accordianButton div-->, Some of the rows will echo out the content, while some of the rows will throw the Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in... error. Any idea why? Go here to see what I mean: http://www.chalmerscommunitychurch.com/P2P_archives.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Pastor to People Blog Archives</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"> </script> <script type="text/javascript" src="js/javascript.js"> </script> <style> .accordionButton { width: 100%; height:30px; float: left; background: url(../images/button.png); border-bottom: 1px solid #FFFFFF; cursor: pointer; } .accordionContent { width: 100%; float: left; display: none; } </style> </head> <body> <?php require("include.php"); $con = mysql_connect("$db_host","$db_username","$db_pass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("chalmers_db", $con); $result = mysql_query("SELECT title, date FROM blog"); while($row = mysql_fetch_array($result)) { $title=$row['title']; $sqldate=$row['date']; $date=date('m-d-Y',strtotime($sqldate)); ?> <!--start accordionButton div--> <div class="accordionButton"><?php echo $title;?>, <?php echo $date;?> </div> <!--end accordianButton div--> <?php $query = mysql_query("SELECT content FROM blog WHERE title = '".$title."' ORDER BY date DESC"); while ($row = mysql_fetch_array($query)){ $content = $row['content']; ?> <!--start accordionContent div--> <div class="accordionContent" align="justify"> <?php echo $content;?> </div> <!--end accordionContent div--> <?php } ?> <?php } ?> <p><p><p><p><a href="http://www.chalmerscommunitychurch.com"><h3>Back to Chalmers Community Church</h3></a> </body> </html> Hi I'm currently having a problem with my chat script each time I'm trying to insert " or brackets etc... I get the error
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/u471530368/public_html/chat/page.php on line 201
Here is the lines at line 201
// check to see if a duplicate exists $sql = "SELECT * FROM StringyChat WHERE StringyChat_ip=\"$ip\" AND StringyChat_message=\"$msg\" AND StringyChat_time>($post_time - 30 )"; $result = mysql_query($sql); $myrow = mysql_fetch_array($result); if($myrow["StringyChat_message"] == "") { // Checks if record not matching in db // Save the record $sql = "INSERT INTO StringyChat (StringyChat_ip,StringyChat_name,StringyChat_message,StringyChat_time) VALUES (\"$ip\",\"$name\",\"$msg\",$post_time)"; $result = mysql_query($sql); $theTo = $email_notification_to; $theSubject = "New StringyChat post at ".$domain_installed; $theMessage = "A new StringyChat post has been made.\n\n"; $theMessage .= $name . "\n"; $theMessage .= date("H:i - d/m/y", $post_time) . "\n"; $theMessage .= $message_emailable . "\n\n"; $theMessage .= "Visit ".$domain_installed." to view StringyChat and much more!"; $theHeaders = "From: StringyChat at ".$domain_installed." <".$email_notification_to.">\r\n"; mail($theTo,$theSubject,$theMessage,$theHeaders); } else { echo "<span style='color:#10ce59'>Duplicate post detected!</span><p>"; } } else { echo "<span style='color:#10ce59'>You can't send blanks!</span><br><br>"; }My full script is <?php define('TIMEZONE', 'Africa/Harare'); date_default_timezone_set(TIMEZONE); ?> <html><br> <b><u>Chat Beta:</u></b> <span style="color:#ff0000"><br>Errors may apply please send feedback with contact us regarding problems!</span> <br><a href="page.php">Reload</a> </html> <? // database connection info $conn = mysql_connect('*******','********','*****') or trigger_error("SQL", E_USER_ERROR); $db = mysql_select_db('*******',$conn) or trigger_error("SQL", E_USER_ERROR); // find out how many rows are in the table $sql = "SELECT COUNT(*) FROM StringyChat"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); $r = mysql_fetch_row($result); $numrows = $r[0]; // number of rows to show per page $rowsperpage = 20; // find out total pages $totalpages = ceil($numrows / $rowsperpage); // get the current page or set a default if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) { // cast var as int $currentpage = (int) $_GET['currentpage']; } else { // default page num $currentpage = 1; } // end if // if current page is greater than total pages... if ($currentpage > $totalpages) { // set current page to last page $currentpage = $totalpages; } // end if // if current page is less than first page... if ($currentpage < 1) { // set current page to first page $currentpage = 1; } // end if // the offset of the list, based on current page $offset = ($currentpage - 1) * $rowsperpage; /* * StringyChat * * Please refer to readme.txt supplied with the StringyChat distribution for information on * installing and configuring. * */ define('TIMEZONE', 'Africa/Harare'); date_default_timezone_set(TIMEZONE); include("chat_code_header.php"); $result = mysql_query("SELECT * FROM ".$ConfigTable, $db); $myrow = mysql_fetch_array($result); $domain_installed = $myrow["domain_installed"]; // The domain StringyChat is installed on $install_url = $myrow["install_url"]; // URL to install dir of StringyChat $name_size = $myrow["name_size"]; // Maximum size of the name $message_size = $myrow["message_size"]; // Maximum message size. Do not exceed 250 as this is the database limit. $line_length = $myrow["line_length"]; // Maximum length of words in a line. Anything above this value will be split. $ShowPostNum = $myrow["show_posts"]; // The number of historic posts to load and display. $email_notification = $myrow["email_notification"]; // Send email to administrator when new posts are made. 0 = No, 1 = Yes $email_notification_to = $myrow["email_notification_to"]; // The email address to send notifications to if ($_SERVER['REQUEST_METHOD'] == "POST" && !empty($_POST['StringyChat_name'])) { $StringyChat_name = $_POST['StringyChat_name']; $StringyChat_message = $_POST['StringyChat_message']; } ?> <div id="StringyChat"> <? // Check if visitor's IP is banned. If so, do not display the form, // show a banned IP message instead. $name = $_SERVER["HTTP_X_MXIT_NICK"]; if(!isset($name)) { $name = "SYSOP"; } $ip = $_SERVER["REMOTE_ADDR"]; $sql = "SELECT * FROM StringyChat_IPBan WHERE ip=\"$ip\""; $result = mysql_query($sql); $myrow = mysql_fetch_array($result); if($myrow["ip"] == "") { // Checks if IP not found in banned list ?> <html><form name="StringyChat_form" method="POST" action="<? echo $_SERVER['REQUEST_URI']; ?>"> <input type="hidden" name="StringyChat_name" class="StringyChatFrm" value="<?php echo $name ?>" size="20"> <textarea name="StringyChat_message" class="StringyChatFrm" cols="20" rows="1"></textarea> <br> <input name="StringyChat_submit" class="StringyChatFrm" type="submit" value="Post Message"> </form> </html> <? } else { echo "<span style='color:#10ce59'><u>Dear User, you have been banned from the Chat due to not following the rules. You will need to come back regularly to see if you were unbanned. Until then, goodbye!</u></span>"; } // Should we try to create a post? if (isset($StringyChat_name) && isset($StringyChat_message)) { // Remove whitespaces and slashes. $name = trim(stripslashes($StringyChat_name)); $message = trim(stripslashes($StringyChat_message)); // Check name and message have been entered. if (strlen($name) > 0 && strlen($message) > 0) { // Limit the size of the fields as per variable defnitions. if (strlen($name) > $name_size) { $name = substr($name, 0, $name_size); } if (strlen($message) > $message_size) { $message = substr($message, 0, $message_size); } // Remove new lines from name. $name = str_replace("\n", " ", $name); // Stripping out \r's so email formattnig appears correctly. $message = str_replace("\r", "", $message); // Create an email-friendly version of the message. $message_emailable = str_replace("<br>", "\n", $message); $result_wordswap = mysql_query("SELECT * FROM ".$WordBanTable,$db); while ($myrow_wordswap = mysql_fetch_array($result_wordswap)) { $the_word = $myrow_wordswap["word"]; $message_emailable = ereg_replace($the_word, "!*#$%",$message_emailable); } // Replace the new lines with encoded line breaks for HTML (thanks milahu). $message = str_replace("\n", "c#lb", $message); // Use HTML encoding on ame and message so database doesn't misinterpret data. $name = htmlentities($name); $message = htmlentities($message, ENT_COMPAT); // IP address of submitter and time of post. $ip = $_SERVER["REMOTE_ADDR"]; $name = $_SERVER["HTTP_X_MXIT_NICK"]; $msg = $_POST['StringyChat_message']; $post_time = date("U"); $mxitid = $_SERVER["HTTP_X_MXIT_LOGIN"]; if(!isset($mxitid)) { $mxitid = "DEFAULT"; } if(!isset($name)) { $name = "SYSOP"; } // check to see if a duplicate exists $sql = "SELECT * FROM StringyChat WHERE StringyChat_ip=\"$ip\" AND StringyChat_message=\"$msg\" AND StringyChat_time>($post_time - 30 )"; $result = mysql_query($sql); $myrow = mysql_fetch_array($result); if($myrow["StringyChat_message"] == "") { // Checks if record not matching in db // Save the record $sql = "INSERT INTO StringyChat (StringyChat_ip,StringyChat_name,StringyChat_message,StringyChat_time) VALUES (\"$ip\",\"$name\",\"$msg\",$post_time)"; $result = mysql_query($sql); $theTo = $email_notification_to; $theSubject = "New StringyChat post at ".$domain_installed; $theMessage = "A new StringyChat post has been made.\n\n"; $theMessage .= $name . "\n"; $theMessage .= date("H:i - d/m/y", $post_time) . "\n"; $theMessage .= $message_emailable . "\n\n"; $theMessage .= "Visit ".$domain_installed." to view StringyChat and much more!"; $theHeaders = "From: StringyChat at ".$domain_installed." <".$email_notification_to.">\r\n"; mail($theTo,$theSubject,$theMessage,$theHeaders); } else { echo "<span style='color:#10ce59'>Duplicate post detected!</span><p>"; } } else { echo "<span style='color:#10ce59'>You can't send blanks!</span><br><br>"; } unset($_POST["StringyChat_name"]); unset($_POST["StringyChat_message"]); unset($StringyChat_ip); unset($StringyChat_name); unset($StringyChat_message); unset($StringyChat_time); unset($mxit_id); } // get the info from the db $sql = "SELECT StringyChat_time, StringyChat_name, StringyChat_message FROM StringyChat ORDER BY id DESC LIMIT $offset, $rowsperpage"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); function filterBadWords($str) { $result1 = mysql_query("SELECT word FROM StringyChat_WordBan") or die(mysql_error()); $replacements = ":-x"; while($row = mysql_fetch_assoc($result1)) { $str = eregi_replace($row['word'], str_repeat(':-x', strlen($row['word'])), $str); } return $str; } // while there are rows to be fetched... while ($list = mysql_fetch_assoc($result)) //while (($pmsg = $list['StringyChat_message'] == $bwords) ? ":-x" : $list['StringyChat_message']) { // echo data //echo ($pmsg = ($list['StringyChat_message'] == $bwords) ? ":-x" : $list['StringyChat_message']) $admin = array('cobusbo','Admin+TT'); if (in_array($list['StringyChat_name'], $admin)) { print '<span style="color:#828282">' . '(' . date( 'D H:i:s', $list['StringyChat_time'] ) . ') ' . '</span>' . '<span style="color:red">' . '<b>' . $list['StringyChat_name'] . '</b>' . ' : ' . filterBadWords($list['StringyChat_message']) . '</span>' . '<br />' . '<p>'; } else { print '<span style="color:#828282">' . '(' . date( 'D H:i:s', $list['StringyChat_time'] ) . ') ' . '</span>' . '<b>' . $list['StringyChat_name'] . '</b>' . ' : ' . filterBadWords($list['StringyChat_message']) . '<br />' . '<p>'; } } // Load up the last few posts. The number to load is defined by the "ShowPostNum" variable. $result = mysql_query("SELECT * FROM ".$dbTable." ORDER BY StringyChat_time DESC LIMIT " . $ShowPostNum,$db); include("sort_widths.php"); while ($myrow = mysql_fetch_array($result)) { $msg = $myrow["StringyChat_message"]; // Convert the encoded line break into an actual <br> tag (thanks milahu) $msg = str_replace("c#lb", "<br>", $msg); // Convert the encoded image tag into a html tag $msg = eregi_replace("im#([a-z]{3})", "<img src=\"http://".$install_url."images/\\1.gif\" alt=\"emoticon\">",$msg); // split the lines $msg = htmlwrap($msg, $line_length); $result_wordswap = mysql_query("SELECT * FROM ".$WordBanTable,$db); while ($myrow_wordswap = mysql_fetch_array($result_wordswap)) { $the_word = $myrow_wordswap["word"]; $msg = ereg_replace($the_word, ":-x",$msg); } } ?> <? // end while /****** build the pagination links ******/ // range of num links to show $range = 3; // if not on page 1, don't show back links if ($currentpage > 1) { // show << link to go back to page 1 echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=1'><<</a> "; // get previous page num $prevpage = $currentpage - 1; // show < link to go back to 1 page echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage'><</a> "; } // end if // loop to show links to range of pages around current page for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) { // if it's a valid page number... if (($x > 0) && ($x <= $totalpages)) { // if we're on current page... if ($x == $currentpage) { // 'highlight' it but don't make a link echo " [<b>$x</b>] "; // if not current page... } else { // make it a link echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> "; } // end else } // end if } // end for // if not on last page, show forward and last page links if ($currentpage != $totalpages) { // get next page $nextpage = $currentpage + 1; // echo forward link for next page echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage'>></a> "; // echo forward link for lastpage echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages'>>></a> "; } // end if /****** end build pagination links ******/ ?><br> <html> <span style="color:grey"><i>Type Your Message NOW!</i></span> <p><a href="page.php">Reload</a> | <a href="http://tt.2fh.co">Home</a><br></html>Any help please... If I send normal messages I don't get any errors... I'm trying to list all the tables in my database. I got this code pretty much "word" for word from the example at php.net, but I get: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in E:\wamp\www\test\test-in.php on line 67 <?php $db= $_POST['db']; $sql= "SHOW TABLES FROM $db"; $result=mysql_query($sql); while ($tblarray = mysql_fetch_row($result)){ ?><a href="?tablename=<?php echo $tblarray[0];?>"><?php echo $tblarray[0];?></a><?php } ?> Hey guy's, have been stuck at this hurdle for a little whole now and I can't seem to find the right solution and would very much appreciate anyones help on this. Ok, so I have a table of votes and each time a user votes, they're added to this table. Now, I have a 'pool' table which will display certain items. What I'm trying to do is display the 'pool' items, but if this specific user has already voted on this particular item, then I want it to skip the item in the 'pool' and go to the next item, until the argument of has that user voted is false. The current code I'm pasting will obviously not work, it isn't even in the right position, but I've separated it so that you can hopefully understand what I'm trying to do in order to help. Below is the code I use to check if a user has already voted on a particular photo: <?php $result=mysql_query("SELECT * FROM votes WHERE vVoter='$_SESSION[userID]' AND vPhoto='$_SESSION[currentphoto]'"); $rowCheck = mysql_num_rows($result); $alreadyv = 0; if($rowCheck > 0){ $alreadyv = 1; //user has already voted on this photo, need to use this info to be able to skip it in the 'pool' } else { //do nothing } ?> totalVoted is basically how many times a user has voted, so that people who vote more, get more votes: <?php $result=mysql_query("SELECT * FROM pool ORDER BY totalVoted DESC LIMIT 1"); $rowCheck = mysql_num_rows($result); if($rowCheck > 0){ while($row = mysql_fetch_array($result)){ $photoid = $row['photoInPool']; $result2=mysql_query("SELECT * FROM photos WHERE pID='$photoid'"); $rowCheck2 = mysql_num_rows($result2); if($rowCheck2 > 0){ while($row2 = mysql_fetch_array($result2)){ if($alreadyv == 1) { //I NEED THIS TO SHOW THE NEXT PHOTO IN THE ARRAY, HOWEVER, IF THEY HAVE ALREADY VOTED ON THE NEXT PHOTO, IT WILL STILL DISPLAY IT, THIS IS MY PROBLEM I NEED HELP WITH PLEASE } elseif ($alreadyv != 1) { $fname = $row2['pFileName']; } } } $_SESSION[currentphoto] = $row['photoInPool']; echo "<center><img src='user_images/$fname'></center>"; } } ?> I hope I've explained this well enough and hope somebody can help. Many thanks in advance Thanks for reading! I'm working on a site and it won't display my records from the database. I have a little filter system that did work, but now it doesn't. I get the following error message: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/vhosts/60608.glrdmd.eu/httpdocs/jakesite/select3.php on line 26 Relevant code to the error is: Code: [Select] <?php include("connection.php"); if(isset($_POST['Graphic']) && $_POST['Graphic'] == 'yes') { $result1 = "graphic"; } if(isset($_POST['Interactive']) && $_POST['Interactive'] == 'yes') { $result2 = "interactive"; } if(isset($_POST['Websites']) && $_POST['Websites'] == 'yes') { $result3 = "websites"; } $order = $_POST['group1']; $sql = ("SELECT * FROM 'jake_portfolio' WHERE CAT = '$result1' OR CAT = '$result2' OR CAT = '$result3' ORDER BY '$order' LIMIT 0, 4"); $result = mysql_query($sql); $checked = "checked"; $row = mysql_fetch_array($result); ?> Does anyone see what I am doing wrong here? $getURL = mysql_fetch_assoc(mysql_query("SELECT `urlname` FROM `workingurls` ORDER BY RAND() LIMIT 1")); spits out Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /public_html/script.php on line 130 How do you make mysql_fetch_assoc a valid MySQL result resource? Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource on line 14. <?PHP require_once("dbcheck.php"); require_once("check.php"); $Username=$_COOKIE['Username']; $Password=$_COOKIE['Password']; $Nickname=$_COOKIE['Nickname']; $Username=mysql_real_escape_string($Username); $Password=mysql_real_escape_string($Password); date_default_timezone_set('Asia/Calcutta'); $action = $_GET['do']; $Result=mysql_query("SELECT * FROM Checks WHERE UserName='$Username'"); $Rowexist=mysql_num_rows($Result); if($Rowexist!=0){ while($Rows=mysql_fetch_array($Result)) { $Serial = $Rows['Serial']; $Banned = $Rows['Banned']; $IP = $Rows['IP']; $Used = $Rows['Used']; $First = $Rows['First']; $Duration = $Rows['Duration']; $Total = $Rows['Total']; $Time = $Rows['Time']; } if($action=="" || $action=="Banlist"){ mysql_query("UPDATE Checks SET NickName='$Nickname' WHERE UserName='$Username'"); ?> Hi guys, I'm doing a website for the condo and I'm having troubles with the new year party registration form. I think it's got something to do with my file handling. When I run it on my wamp server, it works fine. But when I upload it onto the internet it gives me a whole bunch of warnings: Warning: fopen(newYearParty.txt) [function.fopen]: failed to open stream: Permission denied in /www/zymichost.com/i/n/d/inderasubangcondo/htdocs/newYrRegTq.php on line 18 Warning: fgets(): supplied argument is not a valid stream resource in /www/zymichost.com/i/n/d/inderasubangcondo/htdocs/newYrRegTq.php on line 19 Warning: fgets(): supplied argument is not a valid stream resource in /www/zymichost.com/i/n/d/inderasubangcondo/htdocs/newYrRegTq.php on line 20 Heres my code: <?php $nam = $_POST["nam"]; $block = $_POST["block"]; $floor = $_POST["floor"]; $house = $_POST["house"]; $adults = $_POST["adults"]; $children = $_POST["children"]; $guests = $_POST["guests"]; $nam = $_POST["nam"]; global $fn, $ft; //set id and update total numbers $fn = fopen("newYearParty.txt","a+"); $line1 = fgets($fn); $arr1 = explode(": ", $line1); //adults $line2 = fgets($fn); $arr2 = explode(": ", $line2); //children $line3 = fgets($fn); $arr3 = explode(": ", $line3); //guests $line4 = fgets($fn); $arr4 = explode(": ", $line4); //total $line4 = fgets($fn); //blank line $numAdults = $arr1[1]+$adults; $numChildren = $arr2[1]+$children; $numGuests = $arr3[1]+$guests; $numTotal = $numAdults+$numChildren+$numGuests; $id = "nothing"; while(!feof($fn)) { $line = fgets($fn); //id $arr = explode(": ", $line); $id = $arr[1] + 1; //get latest id and add 1 to it for($i=0; $i<6; $i++) { $line = fgets($fn); } } fclose($fn); if($id == "nothing") { $id = "0"; } //end of set id //write to file $line0 = "\r\nId: ".$id."\r\n"; $line1 = "Name: ".$nam."\r\n"; $line2 = "Unit: ".$block."-".$floor."-".$house."\r\n"; $line3 = "Adults: ".$adults."\r\n"; $line4 = "Children: ".$children."\r\n"; $line5 = "Guests: ".$guests."\r\n"; $fn = fopen("newYearParty.txt","a+"); fwrite($fn, $line0); fwrite($fn, $line1); fwrite($fn, $line2); fwrite($fn, $line3); fwrite($fn, $line4); fwrite($fn, $line5); fclose($fn); //end of write to file //write new numbers to file $ft = fopen("newYearPartyTemp.txt","a+"); $lineA = "Adults: ".$numAdults."\r\n"; $lineC = "Children: ".$numChildren."\r\n"; $lineG = "Guests: ".$numGuests."\r\n"; $lineT = "Total: ".$numTotal."\r\n\r\n"; fwrite($ft, $lineA); fwrite($ft, $lineC); fwrite($ft, $lineG); fwrite($ft, $lineT); $fn = fopen("newYearParty.txt","a+"); for($i=0; $i<5; $i++) { $line = fgets($fn); } while(!feof($fn)) { $line = fgets($fn); fwrite($ft, $line); } fclose($fn); fclose($ft); unlink("newYearParty.txt"); //delete newYearParty.txt rename("newYearPartyTemp.txt","newYearParty.txt"); //rename newYearPartyTemp.txt to newYearParty.txt //end of write new numbers to file ?> Any ideas on how to fix this up? Thanks a lot in advance. My new host (Siteground) cloned and moved my html/php site (built by the previous owner) from Heart Internet server. All of the site works except for the sidebar, I get these 2 errors. Anyone shed any light on these at all?
Warning: readdir(): supplied argument is not a valid Directory resource in /home/customer/www/dunster.org.uk/public_html/include/toolbox.php on line 97
Warning: opendir(/home/sites/dunster.org.uk/public_html//local_information) [function.opendir]: failed to open dir: No such file or directory in /home/customer/www/dunster.org.uk/public_html/include/toolbox.php on line 86 so I have an array with a bunch of photos, and I'm trying to create a thumbnail of each to display on a page with a link to the full sized image but I'm getting the error in the subject title... if I just display the images in the array without trying to resize them it works fine... can anyone clue me into why this isn't working please. echo ("<a href='" . $img['file'] . "'>"); $new_width = (floor($img['size'][0] * ".25")); $new_height = (floor($img['size'][1] * ".25")); $tmp_img = imagecreatetruecolor($new_width, $new_height); imagecopyresized($tmp_img, $img['file'], 0, 0, 0, 0, $new_width, $new_height, $img['size'][0], $img['size'][1]); echo ("<img src='" . $tmp_img . " . $img['size'][3] , "' alt=''><br>\n"); echo basename($img['file']); echo "</a><br>\n"; some please help - basically have a simple password change php page $sql="UPDATE t_members SET Password = '$New_Password' WHERE Username = '$My_Username' AND Password = '$Old_Password'"; echo $sql; $result=mysql_query($sql) or die(mysql_error()); $firstcount = mysql_num_rows($result); and i get this annoying error Warning: mysql_num_rows(): supplied argument is not a valid the sql statement works as i see it updating the database correctly |