Click to See Complete Forum and Search --> : problem on php and mysql code


lavanya.nakka
09-20-2006, 07:52 AM
hi this is lavanya.iam sending u the code .there a problem in that.what the problem is the added list has to be displayed in the same page . but iam its added in the next <?php

$link = mysql_connect('localhost', 'root');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
//echo 'Connected successfully';
$db_selected=mysql_select_db('database1', $link);
if(!$db_selected){
die ('Can\'t use database1 : ' . mysql_error());
}
//echo 'connected successfully<br />';
?>
<html>
<head>
<title>template</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="market tools/CSS/home.css" rel="stylesheet" type="text/css">
<link href="market tools/CSS/gre.css" rel="stylesheet" type="text/css">
<script language="javascript" type="text/javascript">
function changeColor(colourVa11,colVal2)
{
ss
document.getElementById("indexTable").style.backgroundColor = "#"+colourVa11;
document.getElementById("table2").style.backgroundColor = "#"+colVal2;

}


</script>
<script language="JavaScript">
<!--

function SymError()
{
return true;
}

window.onerror = SymError;

var SymRealWinOpen = window.open;

function SymWinOpen(url, name, attributes)
{
return (new Object());
}

window.open = SymWinOpen;

//-->
</script>

<script src="js/yellow_fade_technique.js" type="text/javascript"></script>
<script src="js/prototype.js" type="text/javascript"></script>
<script src="js/controls.js" type="text/javascript"></script>
<script src="js/dragdrop.js" type="text/javascript"></script>
<script src="js/effects.js" type="text/javascript"></script>
<script src="js/misc.js" type="text/javascript"></script>
<script src="js/blocks.js" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[

function post_page_request(url) {
$('invisible').action = url
$('invisible').submit()
}

//]]>
</script>
<style type="text/css">
<!--
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
}
-->
</style>
</head>

<script type="text/javascript">
listsBlock.count = 4
listsBlock.reorder.url = '/page/747142/lists/reorder'
</script>

<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- ImageReady Slices (template.psd) -->
<table width="775" height="335" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
<tr>
<td width="775" height="100%" valign="top">
<table width="775" height="25" border="0" cellpadding="0" cellspacing="0" id="indexTable" bgcolor="#A4A5A4">
<tr>
<td rowspan="2" width="542" background=""><img src="Market tools/images/logo.png" width="175" height="64"></td>
<td width="233" height="25" class="top">Home | SiteMap | Contact us</td>
</tr>
<tr>
<td width="233" height="25" class="top"><table align="right" cellpadding="0" cellspacing="0" >
<tr><td>
<img src="Market tools/images/58b1f5.gif" width="10" height="10" onClick="changeColor('58b1f5','e0f0fd')" >
<img src="Market tools/images/3640a5.gif" width="10" height="10" onClick="changeColor('0099cc','d7eafc')" >
<img src="Market tools/images/f8ae10.gif" width="10" height="10" onClick="changeColor('f8ae10','f6ebd2')" >
<img src="Market tools/images/ffffff.gif" width="10" height="10" onClick="changeColor('a4a5a4','f0f1f0')" > </td></tr></table></td>
</tr>
</table>
<table width="775" border="0" cellspacing="0" cellpadding="0" id="table2" bgcolor="#F0F1F0"s>
<tr>
<td height="100%" colspan="2" valign="top" ><table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td colspan="8" class="portfolio">Portfolio </td>
</tr>
<div class="list_head">
<?
$query1 = ("SELECT * FROM list");
$result = mysql_query($query1, $link);
//echo $result;
//$row = mysql_fetch_assoc($result);
$i = 0;
while($row = mysql_fetch_assoc($result))
{
$i++;
$lid=$row[listid];
?>
<tr>
<td><div class="list"><?=$row[listname]?></div></td>
<td><div class="listmenu">Last Trade</div></td>
<td><div class="listmenu">Change</div></td>
<td><div class="listmenu">Buy Price</div></td>
<td><div class="listmenu">Shares</div></td>
<td><div class="listmenu">Investments</div></td>
<td><div class="listmenu">Current Value</div></td>
<td><div class="listmenu">Gain/Loss</div></td>
</tr>

<?
$query2 = ("SELECT * FROM items where listid=$lid");
$result2 = mysql_query($query2, $link);
//echo $result;
//$row = mysql_fetch_assoc($result);
$i = 0;
while($row = mysql_fetch_assoc($result2))
{
$i++;

?>
<tr> <td class="listnames"><?=$row[name]?></td>
<td class="liftvalu"><?=$row[lastttrade]?></td>
<td class="liftvalu"><?=$row[buyprice]?></td>
<td class="liftvalu"><?=$row[change]?></td>
<td class="liftvalu"><?=$row[shares]?></td>
<td class="liftvalu"><?=$row[investments]?></td>
<td class="liftvalu"><?=$row[currentvalue]?></td>
<td class="liftvalu"></td></tr>
<? }?>

<div id="lists">

<div class="list" id="list_629229">


<tr>

<td>

<div id="additemdialog_629229" class="showhidedialog" style="margin-left: 24px; display: none">
<form action="db.php" name="item<?=$i?>" method="post" onSubmit="if (Field.present("item<?=$i?>")) { itemsBlock.beforeAdd(629229); new Ajax.Request('test.php?list_id=629229', {asynchronous:true, evalScripts:true, onComplete:function(request){itemsBlock.addCompleted(request, 629229)}, parameters:Form.serialize(this)}); itemsBlock.afterAdd(629229); }; return false;">
<p>
<input class="additemfield" id="item<?=$i?>" name="item<?=$i?>" type="text" />

<img alt="Indicator" height="16" id="items_indicator_629229" src="/images/indicator.gif?1157515943" style="display: none" width="16" /> </p>

<p class="submit">
<input name="listid" type="hidden" value="<?=$lid?>" />
<input name="commit" type="submit" value="Add item" /> or
<a href="#" id="add_item_cancel_629229" onClick="itemsBlock.display(629229); return false;">Cancel</a> </p>
</form>
</div>

<div id="additem_629229">
<span class="admin">
<div align="left"><span id="list_edit_toggle_629229" style="margin-left: 24px;">
<a href="#" onClick="itemsBlock.edit.show(629229); return false;">Add item</a>or
<a href="#" onClick="itemsBlock.display(629229); return false;">Cancel</a></span> </div>
</div>
</td>

</tr>

<tr><td colspan="8">
<div id="addlistdialog" class="showhidedialog dialogbg" style="display: none">

<!-- once there are lists on the page, use this form to create lists -->
<div id="create_new_list">
<form action="db.php" name="name<?=$i?>" method="post" onSubmit="if(Field.present('newlistname<?=$i?>')) { listsBlock.add.before(); new Ajax.Request('/page/754577/lists/add', {asynchronous:true, evalScripts:true, onFailure:function(request){listsBlock.add.failure(request)}, onSuccess:function(request){listsBlock.add.success(request)}, parameters:Form.serialize(this)}); }; return false;">
<h3>Give this list a name:</h3>
<p>
<?
$lid = $row[id];
?>
<input name="list" type="hidden" value="<?=$lid?>" />
<input class="additemfield" id="newlistname<?=$i?>" name="name<?=$i?>" type="text" />
<img alt="Indicator" height="16" id="lists_indicator" src="/images/indicator.gif?1158554923" style="display: none" width="16" />
</p>

<p class="submit">
<input name="commit" type="submit" value="Add list" /> or
<a href="#" onClick="listsBlock.edit.hide(); return false;">Close</a>
</p>
</form>
</div>


</div>

<div class="addcapsule withreorder" id="addlist">

<div class="addright">
<a href="#" id="list_add_toggle" onClick="listsBlock.edit.show(); return false;">Make a new list</a>
<span class="addpipe" id="addlist_separator" >|</span>
<a href="#" id="reorder_lists" onClick="listsBlock.reorder.toggle(); return false;" style="">Reorder lists</a>
</div></div>
</td></tr></div>
<? } ?></div>




<tr>
<td colspan="8" class="listnames"><a href="market tools/CSS/gre.css">green</a></td>
</tr>
<tr>
<td colspan="8" class="listnames">&nbsp;</td>
</tr>
<tr>
<td colspan="8" class="listnames">&nbsp;</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<!-- End ImageReady Slices -->
</body>
</html>page .plz solve my problem.and is there any modificationplz tell that one

lavanya.nakka
09-20-2006, 07:53 AM
plz reply soon for problem on php

nooor83
09-20-2006, 07:59 AM
what is the error u r getting :[

lavanya.nakka
09-20-2006, 11:54 PM
iam not getting any errog but if i add any list it shows request could be completed please try agan
add item is working properly but inthe that cancel is not working.next problem if we add any list then the added list must be displayed inthe sam page but iam getting it in the next page.these are the problems.
Thanks,
Lavanya.

lavanya.nakka
09-21-2006, 03:33 AM
is anybody there to help me