Error in Classified Scripts of mysql data seek

hello allzzzzz hope you are fine i need small help please solve it

Error is

Warning: mysql_data_seek() [function.mysql-data-seek]: Offset 12 is invalid for MySQL result index 6 (or the query data is unbuffered) in C:\wamp\www\Classified\admin\addsubcat.php on line 90

and Here is The file Code

<?php include "connect.php"; session_start(); if(isset( $_SESSION['diradmin'])) { print ""; print ""; print "
"; include "adminleft.php"; print ""; print ""; print ""; print "
Add Subcategory
"; if(isset($_POST['submit'])) { if(!isset($_POST['cat'])) { print "You did not type in a category name."; } else { $cat=$_POST['cat']; $checkdup="SELECT * from cl_categories where CatName='$cat'"; $checkdup2=mysql_query($checkdup) or die("Could not check for dups"); $checkdup3= mysql_fetch_array($checkdup2); if($checkdup3) { print "A category of that name already exists"; } else { $catdes=$_POST['catdes']; $catparent=$_POST['catparent']; $addcat="INSERT into cl_categories (CatName,Catdescription,CatParent) values('$cat','$catdes','$catparent')"; mysql_query($addcat) or die("Could not update Category"); print "Category Added
"; } } } else { print "Type in name of category to add:
"; print ""; print "
"; print "Subcategory of:
"; print ""; $query = "SELECT * FROM cl_categories order by CatName ASC"; $sql = mysql_query($query) or handledberror(7,mysql_error()); traverse(0,0,$sql); print ""; print "Category Description:
"; print "
"; print ""; } print "
"; print "
"; } else { print "Not logged in"; } ?> <?php function traverse($root, $depth, $sql) { $row=0; while ($acat = mysql_fetch_array($sql)) { if ($acat['CatParent'] == $root) { print ""; $j=0; while ($j<$depth) { print "  "; $j++; } if($depth>0) { print "-"; } print $acat['CatName'] . ""; mysql_data_seek($sql,0); traverse($acat['CatID'], $depth+1,$sql); } $row++; mysql_data_seek($sql,$row); } } ?>

Hello, I am new to the forum. Thanks.

Not sure what you are really trying to do with that code.
What is the function traverse supposed to be doing?

It appears to be a recursive routine which is not suggested. (It keeps calling itself.)
A recursive routine can cause all kinds of issues. It looks like it’s output is only filling
a select clause. So, it is some odd code that calls itself to load records into a select
clause?!? Is that correct? If so, there are many better ways to do this.

Please let us know what the traverse routine is suppose to be doing and we will fix you up…

if you have some other ways to do the select calls then plz suggest me m doing to call data from data base to web page in option menu.

Well, there are many many ways to do select clauses from databases… Here is one simple way I do it:

[php]

Select Product Name: <?php // connect to your database, get links data $dbconn = mysql_connect( $hostname, $username, $password ); // Select the database @mysql_select_db($dbname); $query="SELECT * FROM Products"; $dbresults = mysql_query ( $query, $dbconn); // loop through the results, creating an option list while( $row = mysql_fetch_row($dbresults) ) print "" . $row[1] . "\n"; // close database connection.. mysql_close($dbconn); ?>
[/php] Simple and easy... PLEASE NOTE: The line that creates the OPTION has a single quote and double-quote so that the actual VALUE is inside of single quotes when done. Some people use the VALUE to pass other items such as options for PHP programming... But, this is the basics...

Hope that helps… Good luck…

thanks for help and tell me if you know any best free classifieds scripts

Not sure what you mean by “classifieds”… Do you mean for a classified website, like Craig’sList?
Or, do your mean like blogs? Ebay? Tons of ideas, just not sure what you are asking…

I did a little searching for you. I found a TON of “Open-Source” Classified Ads PHP software on the market.
They are FREE, but, some are ad-driven and some you have to pay to customize them. So, be careful with ones you chose to download…

Give us a little more info on what you mean by “classifieds scripts”…

Hi guys,

Im recent working on my php to add the row in mysql database. I need a bit of your help as I would like to know how to check the data in mysql database if it have added in mysql and then print it out without adding another same row?

heres the current code:

Code:

Sponsor our Newsletter | Privacy Policy | Terms of Service