I am using joomla 1.5.26 and try to embedding code with jumi in my website. The data adding in db and searching from db is working well. But At the purpose of editing or deleting data when i going to pass a parameter from one page to another i struggling with a problem.
Here it is in details :
1st page :I have a table with 4 columns (isbn, author, title, price). All the data of that table are showing from db(by while loop). Now i want to edit and delete those data one by one. These edit & delete option are side by side for each data of that table like :
isbn author title price
1 -- bika -- ctg -- 12 edit delete
2 -- mika -- cog --18 edit delete
3 -- nika -- cbg -- 14 edit delete
when i click on "edit" one of them (for here isbn 1) it takes me an another table of another page with a form containing that particular information. like:
author : mika
title : ctg
price : 12
with a button "done".
After editing existing information when i click done, the edited information will store in db.
In normal php code it works and the code is :
1st page:
Code:
<table border="1">
<?php
if(isset($_POST['submit']))
{
$order = "UPDATE books SET author='$_POST[author]', title='$_POST[title]', price='$_POST[price]' WHERE isbn='$_POST[isbn]'";
mysql_query($order) or die (mysql_error());
}
$order = "SELECT * FROM books ORDER BY author" or die (mysql_error());
$result = mysql_query($order);
while ($row=mysql_fetch_array($result))
{
echo ("<tr>
<td>$row[isbn]</td>
<td>$row[author]</td>
<td>$row[title]</td>
<td>$row[price]</td>
<td> <a href=\"editdata_form.php?isbn=$row[isbn]\"> Edit </a> </td>
<td> <a href=\"delete.php?isbn=$row[isbn]\"> Delete </a> </td>
</tr>");
}
?>
</table>
and 2nd page: for editing form :
Code:
<table>
<?php
$order = "SELECT * FROM books where isbn=$_GET[isbn]";
$result = mysql_query($order);
$row = mysql_fetch_array($result);
?>
<form method="post" action="editordeletedata.php">
<input type="hidden" name="isbn" value="<?php echo "$row[isbn]"?>">
<tr>
<td>Author</td>
<td>
<input type="text" name="author" size="40" value="<?php echo "$row[author]"?>">
</td>
</tr>
<tr>
<td>Title</td>
<td>
<input type="text" name="title" size="40" value="<?php echo "$row[title]"?>">
</td>
</tr>
<tr>
<td>Price</td>
<td>
<input type="text" name="price" size="40" value="<?php echo "$row[price]"?>">
</td>
</tr>
<tr>
<td align="right">
<input type="submit" name="submit" value="Done">
</td>
</tr>
</form>
</table>
But in jumi when i use an article link at the place of
Code:
<a href=\"**editdata_form.php**?isbn=$row[isbn]\"> Edit </a> </td>
in
Code:
<a href=\"**index.php?option=com_content&view=article&id=18&Itemid=18**?isbn=$row[isbn]\"> Edit </a> </td>
it show an error like: "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\www\MyProjects\lh\modules\mod_jumi\tmpl\default.php(12) : eval()'d code on line 15".
I think the isbn=$row[isbn] cannot send the data to the action "article link page", If anyone have any idea or solution please share with me.
Thanks a lot in advance.
chech this url :
http://lhfiberathome.net/index.php?option=com_content&view=article&id=14&Itemid=17