Handling data returned by mysql_fetch_row()

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

The point is to make links in the end of each row just like in
PHPMyAdmin. So after every row there would be links to delete
row(delete row from database) update row (update row from database) the
SQL syntaxes are clear for those functions just the PHP part is

I can make links after each line to those functions, but that is just a
basic HTML and the page followed does not contain the row specific

So how could I do this?

Re: Handling data returned by mysql_fetch_row()

nizar.jouini@webinfo.fi wrote:

Quoted text here. Click to load it


   // loop-stuff here
   for (....) {
     <?= fetch the name or whatever here ?>
     <a href="mydeletescript.php?productid=<?= fetchprodid ?>">del</a>

Now receive the productid on mydeletescript.php with:
$mydelprodid = (int)$_GET["productid"];

Then delete it.

I expect you need a little more security here, so not everybody can delete  
products by calling the script, but this is the idea.
(Try storing in SESSION["isSuperUser"] or something like that and check for  
it before executing.)

I hope this gets you going, because I am not 100% sure I understood the  

Erwin Moller

Re: Handling data returned by mysql_fetch_row()

Thanks for the help but I think that you did not understand it

My intentions were to have things working just like in PHPMyAdmin.
First you retrieve the data from the database as rows (displayed in
html document) and in the end of eatch row you have links to delete
this row or update this row or what so ever.

The problem really comes when you should affect only that row...

Now here's something that i've wrote:

$result = mysql_query ($sql);
$row = mysql_fetch_row($result);
while($row = mysql_fetch_array($result , MYSQL_NUM))
echo "
    <table width=100% border=1 height=18 bgcolor=#DADADA
    <td width=300>    $row[0]    </td>
    <td width=100>    $row[1]    </td>

Now what whould I add here to make it work like in PHPMyAdmin?

Re: Handling data returned by mysql_fetch_row()

Quoted text here. Click to load it

Get the field which contains the ID and submit tablename and ID to the
delete script. If there is no ID, you have to identify the row another way.
A possible (but not very neat) way would be to submit the data of *every*
field on that row and send a DELETE query with there data, using LIMIT 1.

Simon Stienen <http://slashlife.org/
"What you do in this world is a matter of no consequence,
 The question is, what can you make people believe that you have done."
/Sherlock Holmes in A Study in Scarlet by Sir Arthur Conan Doyle/

Re: Handling data returned by mysql_fetch_row()

OK thanks I'll be trying this out this evening...

Site Timeline