GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 13-Dec-2006, 14:31
El Ornitorrinco El Ornitorrinco is offline
New Member
 
Join Date: Dec 2006
Posts: 3
El Ornitorrinco is on a distinguished road

Help a newbie: Writing a Blog


As you've already seen, I'm writing a blog. For my final project for web development. ...And I'm having issues. Other forums have helped me, but they've given me the boot. Seems I get stuck too much for their tastes. (Honestly I'm terrible at coding/programming. In my Java class I spend a good 30 hours per program, everyone else spends 5.)

So the logic I'm using as advised:

- list the database records, usually in a table, each table row contains an entry along with a link to the page that will display the data for editing. The link will usually be something like "edit.php?id=####", where #### is the unique id of that record.
- edit.php will retrieve the id ($_GET['id']) and use it in a query to retrieve the data from the database. Then take that data, and place it into the form fields for editing.
- the user will edit the values, then submit the form to another page, "update.php". That page will receive the input, then run an UPDATE query to change the values in the database.

So far I'm through the first step and stuck midway through the second.
See: www.wvcweb.com

Click on any of the edit buttons, and it will take you to the edit page where it should display the table row that you clicked on but in form format. I don't know whether it's displaying the actual ID that it retrieved from the MySQL database, or whether it's displaying the number assigned to it from PHP.

The edit page:
PHP Code:

<?php
$page_title = "edit.foop";
include("includes/header.inc.html");
include("dbinfo.inc.php");
mysql_connect(localhost,$username,$password);
mysql_select_db($database) or die( "Unable to select database");
$id = $_GET['id'];

$query="SELECT * FROM contacts WHERE (id = '$id')";
$result=mysql_query($query);

$first=mysql_result($result,"first");
$last=mysql_result($result,"last");
$phone=mysql_result($result,"phone");
$mobile=mysql_result($result,"mobile");
$fax=mysql_result($result,"fax");
$email=mysql_result($result,"email");
$web=mysql_result($result,"web");

print "<form action='update1.php'>";
print "<input  name='ud_id' value=$id; ><br />";
print "First Name: <input type='text' name='ud_first' value=$first><br>";
print "Last Name: <input type='text' name='ud_last' value=$last><br>";
print "Phone Number: <input type='text' name='ud_phone' value=$phone><br>";
print "Mobile Number: <input type='text' name='ud_mobile' value=$mobile><br>";
print "Fax Number: <input type='text' name='ud_fax' value=$fax><br>";
print "E-mail Address: <input type='text' name='ud_email' value=$email><br>";
print "Web Address: <input type='text' name='ud_web' value=$web><br>";
print "<input type='Submit' value='Update'>";
print "</form>";

mysql_close();
?>

Last edited by LuciWiz : 13-Dec-2006 at 15:02. Reason: Please insert your Php code between [php] & [/php] tags
  #2  
Old 13-Dec-2006, 18:05
El Ornitorrinco El Ornitorrinco is offline
New Member
 
Join Date: Dec 2006
Posts: 3
El Ornitorrinco is on a distinguished road

Re: Help a newbie: Writing a Blog


No edit button?

Anyway, I've got it working partially, www.wvcweb.com

You can edit a file and it will update it, however it still doesn't show the information from the MySQL table row. Buggery.
  #3  
Old 13-Dec-2006, 19:53
El Ornitorrinco El Ornitorrinco is offline
New Member
 
Join Date: Dec 2006
Posts: 3
El Ornitorrinco is on a distinguished road

Re: Help a newbie: Writing a Blog


Quote:
Originally Posted by El Ornitorrinco
No edit button?

Anyway, I've got it working partially, www.wvcweb.com

You can edit a file and it will update it, however it still doesn't show the information from the MySQL table row. Buggery.

Once again: no edit button? I got it working. I fetched an array and used that information.
 
 

Recent GIDBlogA Week in Kuwait by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
earn money google directory limkockchuan Advertising & Affiliates Forum 0 26-Nov-2006 04:29
Free Blog Hosting - EasyBlog.org Hopio Free Web Hosting 0 28-Nov-2005 04:11
Google attempts to curb blog & guestbook spam Div Search Engine Optimization Forum 7 19-Feb-2005 20:11
Please Help, problems writing newbie c program soulfly C Programming Language 14 04-Mar-2004 15:16
Please Help, problems writing newbie C program ReREVISED soulfly C Programming Language 0 02-Mar-2004 22:01

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 11:27.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.