General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 24th, 2003, 08:20 PM
das das is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 5 das User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to das
Trouble Editing a record

I have a page that has a form. This form is either left empty or populated with a record, depending on what variable is passed. However, when I go to edit a record, the form isn't populated with the records information.

Here's the page passing the variable

PHP Code:
<?php
$db
="";
$connect mysql_connect("","","");
if (! 
$connect)
die (
"Couldn't connect to MySQL");
mysql_select_db($db$connect) or die ("Select DB Error: ".mysql_error());
$query "SELECT * FROM ***";
$result mysql_query($query,$connect);
?>
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<? while ($myrow mysql_fetch_array($result)) {
    
$partydate=$myrow["PartyDay"];
    
$party=$myrow["Party"];
    
$prodco=$myrow["ProdCo"];
    
$address=$myrow["Address"];
    
$city=$myrow["City"];
    
$state=$myrow["State"];
    
$phone=$myrow["Phone"];
    
$partytime=$myrow["PartyTime"];
    
$age=$myrow["Age"];
    
$price=$myrow["Price"];
    
$url=$myrow["URL"];
?>
   <tr>
    <td><?php echo date("F jS, Y",strtotime($partydate)); ?>
    <span class="party"><?php echo "$party"?></span>
    <span class="clubinfo">(<?php echo "$prodco - ""$address, ""$city ""$state - ""$phone ""$partytime ""$age ""$price - "?> <a href="<?php echo "$url"?>"><?php echo "$url"?></a>)</span></td>
    <td><?php echo "<a href=\"eventadd-test1.php?id=".$myrow["ID"]."\">Edit</a>"?>
    <?php echo "<a href=\"eventdelete.php?id=".$myrow["ID"]."\">Delete</a>";?></td>
  </tr>
<?
    
}
?>

</table>


here's the page that has the form
PHP Code:
<?php

if(isset($_POST['submit']))
{
// open connection
$db="";
$connect mysql_connect("","","");
if (! 
$connect)
die (
"Couldn't connect to MySQL");
mysql_select_db($db$connect) or die ("Select DB Error: ".mysql_error());
$sql "INSERT INTO illumparty VALUES ('','$party','$party_day','$prod_co','$location','  $city',
'$state','$infolines','$partytime','$age','$price'  ,'$url')" 
or die("Insert table Error: ".mysql_error());
$result mysql_query($sql);
echo 
"Thank you! Information entered.\n";
}
else if(isset(
$_POST['update']))
{
$db="";
$connect mysql_connect("","","");
mysql_select_db($db,$connect);
$sql "UPDATE illumparty SET party='$party',
party_day='$party_day', prod_co='$prod_co', location='$location', city='$city', state='$state',
infolines='$infolines', partytime='$partytime', age='$age', price='$price', url='$url WHERE ID=$id"
;
$result mysql_query($sql);
echo 
"Thank you! Information updated.<br />
    <a href='eventadd.php'>Enter another event</a><br />
    <a href='events.php'>View Events</a>\n"
;
}
else if(isset(
$_POST['id']))
{
$db="";
$connect mysql_connect("","","");
mysql_select_db($db,$connect);
$result mysql_query("SELECT * FROM illumparty WHERE ID=$id",$connect);
$myrow mysql_fetch_array($result);
?>
<form action="<?php echo $PHP_SELF ?>" method="post">
  <table width="300" border="0">
      <tr>
        <td><input type="hidden" name="ID" value="<?php echo $myrow["ID"]?>"></td>
        <td>&nbsp;</td>
    </tr>
    <tr> 
      <td><div align="right">Name</div></td>
      <td><input name="party" type="text" id="party" value="<?php echo $myrow["party"]?>"></td>
    <tr> 
      <td><div align="right">Date</div></td>
      <td><input name="party_day" type="text" id="party_day" value="<?php echo $myrow["party_day"]?>"></td>
    </tr>
    <tr> 
      <td><div align="right">Promoter</div></td>
      <td><input name="prod_co" type="text" id="prod_co" value="<?php echo $myrow["prod_co"]?>"></td>
    </tr>
    <tr> 
      <td><div align="right">Location</div></td>
      <td><input name="location" type="text" id="location" value="<?php echo $myrow["location"]?>"></td>
    </tr>
    <tr> 
      <td><div align="right">City</div></td>
      <td><input name="city" type="text" id="city" value="<?php echo $myrow["city"]?>"></td>
    </tr>
    <tr> 
      <td><div align="right">State</div></td>
      <td><input name="state" type="text" id="state" value="<?php echo $myrow["state"]?>"></td>
    </tr>
    <tr> 
      <td><div align="right">InfoLines</div></td>
      <td><textarea name="infolines" cols="25" rows="5" id="infolines" value="<?php echo $myrow["infolines"]?>"></textarea></td>
    </tr>
    <tr> 
      <td><div align="right">Time</div></td>
      <td><input name="partytime" type="text" id="partytime" value="<?php echo $myrow["partytime"]?>" size="20"></td>
    </tr>
    <tr> 
      <td><div align="right">Age</div></td>
      <td><input name="age" type="text" id="age" value="<?php echo $myrow["age"]?>" size="20"></td>
    </tr>
    <tr> 
      <td><div align="right">Price </div></td>
      <td><input name="price" type="text" id="price" value="<?php echo $myrow["price"]?>"></td>
    </tr>
    <tr>
      <td><div align="right">URL</div></td>
      <td><input name="url" type="text" id="url" value="<?php echo $myrow["url"]?>"></td>
    </tr>
    <tr>
      <td><div align="right">
          <input type="submit" name="update" value="Update information">
        </div></td>
      <td></td>
    </tr>
  </table>
</form>
<?
}
else
{
?>
<form action="<?php echo $PHP_SELF ?>" method="post" name="EventAdd" id="EventAdd">
  <table width="300" border="0">
    <tr> 
      <td><div align="right">Name</div></td>
      <td><input name="party" type="text" id="party"></td>
    </tr>
    <tr> 
      <td><div align="right">Date</div></td>
      <td><input name="party_day" type="text" id="party_day" size="20"></td>
    </tr>
    <tr> 
      <td><div align="right">Promoter</div></td>
      <td><input name="prod_co" type="text" id="prod_co"></td>
    </tr>
    <tr> 
      <td><div align="right">Location</div></td>
      <td><input name="location" type="text" id="location"></td>
    </tr>
    <tr> 
      <td><div align="right">City</div></td>
      <td><input name="city" type="text" id="city"></td>
    </tr>
    <tr> 
      <td><div align="right">State</div></td>
      <td><input name="state" type="text" id="state"></td>
    </tr>
    <tr> 
      <td><div align="right">InfoLines</div></td>
      <td><textarea name="infolines" cols="25" rows="5" id="infolines"></textarea></td>
    </tr>
    <tr> 
      <td><div align="right">Time</div></td>
      <td><input name="partytime" type="text" id="partytime" size="20"></td>
    </tr>
    <tr> 
      <td><div align="right">Age</div></td>
      <td><input name="age" type="text" id="age" size="20"></td>
    </tr>
    <tr> 
      <td><div align="right">Price </div></td>
      <td><input name="price" type="text" id="price2"></td>
    </tr>
    <tr>
      <td><div align="right">URL</div></td>
      <td><input name="url" type="text" id="url2"></td>
    </tr>
    <tr>
      <td><div align="right">
          <input name="submit" type="submit" id="submit" value="submit">
        </div></td>
      <td><input name="reset" type="reset" id="reset2" value="reset"></td>
    </tr>
  </table>
</form>
<?
}
?>


Can anybody help?

Thanks!

Reply With Quote
  #2  
Old June 25th, 2003, 03:04 AM
laidbak laidbak is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788 laidbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
Send a message via ICQ to laidbak Send a message via AIM to laidbak Send a message via MSN to laidbak Send a message via Yahoo to laidbak
After the line:
$myrow = mysql_fetch_array($result);

add:

PHP Code:
 print_r($myrow);
exit; 


Let me know the results.
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
  #3  
Old June 25th, 2003, 07:49 PM
das das is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 5 das User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to das
nothing happens.

i added the lines to the page.

from the page displaying the records, i click to edit and am taken to the editing page, with just a blank form and nothing additonal on the page.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Trouble Editing a record


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway